Skip to content

Commit

Permalink
Merge pull request #8734 from element-hq/feature/bma/fixRelease
Browse files Browse the repository at this point in the history
Fix release script which download artifact
  • Loading branch information
bmarty authored Jan 17, 2024
2 parents a5df764 + 122018d commit d418525
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion fastlane/metadata/android/en-US/changelogs/40106100.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Main changes in this version: add Mobile Device Managament and functional members support.
Main changes in this version: add Mobile Device Management and functional members support.
Full changelog: https://github.com/element-hq/element-android/releases
27 changes: 13 additions & 14 deletions tools/release/download_github_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
#

import argparse
import hashlib
import json
import os
# Run `pip3 install requests` if not installed yet
import requests
# Run `pip3 install re` if not installed yet
import re

# This script downloads artifacts from GitHub.
# Ref: https://docs.github.com/en/rest/actions/artifacts#get-an-artifact
Expand Down Expand Up @@ -65,22 +66,20 @@
print(args)

# Split the artifact URL to get information
# Ex: https://github.com/element-hq/element-android/suites/9293388174/artifacts/435942121
# Ex: https://github.com/element-hq/element-android/actions/runs/7460386865/artifacts/1156548729
artifactUrl = args.artifactUrl
if not artifactUrl.startswith('https://github.com/'):
print("❌ Invalid parameter --artifactUrl %s. Must start with 'https://github.com/'" % artifactUrl)
exit(1)
if "/artifacts/" not in artifactUrl:
print("❌ Invalid parameter --artifactUrl %s. Must contain '/artifacts/'" % artifactUrl)
exit(1)
artifactItems = artifactUrl.split("/")
if len(artifactItems) != 9:
print("❌ Invalid parameter --artifactUrl %s. Please check the format." % (artifactUrl))

url_regex = r"https://github.com/(.+?)/(.+?)/actions/runs/.+?/artifacts/(.+)"
result = re.search(url_regex, artifactUrl)

if result is None:
print(
"❌ Invalid parameter --artifactUrl '%s'. Please check the format.\nIt should be something like: %s" %
(artifactUrl, 'https://github.com/element-hq/element-android/actions/runs/7460386865/artifacts/1156548729')
)
exit(1)

gitHubRepoOwner = artifactItems[3]
gitHubRepo = artifactItems[4]
artifactId = artifactItems[8]
(gitHubRepoOwner, gitHubRepo, artifactId) = result.groups()

if args.verbose:
print("gitHubRepoOwner: %s, gitHubRepo: %s, artifactId: %s" % (gitHubRepoOwner, gitHubRepo, artifactId))
Expand Down

0 comments on commit d418525

Please sign in to comment.