Skip to content

Commit 8912c47

Browse files
committed
RESOLVED Issue #7
1 parent 14525b1 commit 8912c47

File tree

2 files changed

+23
-14
lines changed

2 files changed

+23
-14
lines changed

.github/scripts/compute-release-tag.py

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,36 @@
33

44
GITHUB_ENV_PATH = os.getenv("GITHUB_ENV")
55

6-
API_ENDPOINT="https://api.github.com/repos/RandomCoderOrg/udroid-download/releases"
7-
86
headers = {
97
"Content-Type": "application/x-www-form-urlencoded"
108
}
119

12-
resp = requests.get(API_ENDPOINT, headers=headers)
13-
Json_data = json.loads(resp.text)
1410

11+
API_ENDPOINT_UOA="https://api.github.com/repos/RandomCoderOrg/ubuntu-on-android/releases"
12+
resp_uoa = requests.get(API_ENDPOINT_UOA, headers=headers)
13+
Json_data2 = json.loads(resp_uoa.text)
1514

15+
udroid_version = Json_data2[0]['tag_name']
16+
udroid_version = udroid_version.replace("v","")
17+
workType = Json_data2[0]['target_commitish']
1618

17-
BUILD_TYPE="AB"
1819

19-
# Geting the latest release tag name
20-
lR = Json_data[0]['tag_name']
21-
pattern = re.compile(r'V(\d+)(\D+)(\d+)')
22-
match = pattern.findall(lR)
23-
udroid_version, RELEASE_TYPE, udroid_download = match[0]
24-
udroid_download = int(udroid_download) + 1
2520

26-
# Latest_release_tag = f"V{udroid_version}{RELEASE_TYPE}{udroid_download}"
27-
Latest_release_tag = "V%s%s%s%s" % (udroid_version,BUILD_TYPE,RELEASE_TYPE,udroid_download)
21+
API_ENDPOINT_UA="https://api.github.com/repos/RandomCoderOrg/udroid-download/releases"
22+
resp_ud = requests.get(API_ENDPOINT_UA, headers=headers)
23+
Json_data = json.loads(resp_ud.text)
24+
dr = Json_data[0]['tag_name']
25+
26+
27+
match = re.compile(r'V(\d+)(\D+)(\d+)').findall(dr)
28+
_, RELEASE_TYPE, IterationNumber = match[0]
29+
IterationNumber = int(IterationNumber) + 1
30+
31+
BUILD_TYPE="AB"
32+
33+
Latest_release_tag = "V-%s-%s-%s%s%s" % (udroid_version,workType,BUILD_TYPE,RELEASE_TYPE,IterationNumber)
2834

2935
with open(GITHUB_ENV_PATH, "a+") as f:
30-
f.write(Latest_release_tag)
36+
f.write(Latest_release_tag)
37+
38+
# print(Latest_release_tag)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
resp1

0 commit comments

Comments
 (0)