Skip to content

Commit 98e1a8c

Browse files
Merge pull request #13 from RandomCoderOrg/7-use-github-apt-to-fetch-latest-release
7 use GitHub apt to fetch latest release
2 parents 6e66f58 + f5be37f commit 98e1a8c

File tree

2 files changed

+36
-9
lines changed

2 files changed

+36
-9
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import os
2+
import json, requests, re
3+
4+
GITHUB_ENV_PATH = os.getenv("GITHUB_ENV")
5+
6+
headers = {
7+
"Content-Type": "application/x-www-form-urlencoded"
8+
}
9+
10+
API_ENDPOINT_UOA="https://api.github.com/repos/RandomCoderOrg/ubuntu-on-android/releases"
11+
resp_uoa = requests.get(API_ENDPOINT_UOA, headers=headers)
12+
Json_data_uoa = json.loads(resp_uoa.text)
13+
14+
# uV = ["v3.1-alpha"][0] # For testing
15+
udroid_version = Json_data_uoa[0]['tag_name'].replace("v","")
16+
17+
API_ENDPOINT_UA="https://api.github.com/repos/RandomCoderOrg/udroid-download/releases"
18+
resp_ud = requests.get(API_ENDPOINT_UA, headers=headers)
19+
Json_data_ua = json.loads(resp_ud.text)
20+
21+
22+
match = re.compile(r'V(\d+)(\D+)(\d+)').findall(Json_data_ua[0]['tag_name'])
23+
_, RELEASE_TYPE, IterationNumber = match[0]
24+
IterationNumber = int(IterationNumber) + 1
25+
26+
BUILD_TYPE="AB"
27+
28+
Latest_release_tag = "V-%s-%s%s%s" % (udroid_version,BUILD_TYPE,RELEASE_TYPE,IterationNumber)
29+
30+
with open(GITHUB_ENV_PATH, "a+") as f:
31+
f.write(Latest_release_tag)
32+
33+
print(Latest_release_tag)

.github/workflows/anchor-build-and-release.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,9 @@ jobs:
4040
name: raw-tarballs
4141
- name: Compute release tag
4242
run: |
43-
udroid_version=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' \
44-
https://github.com/RandomCoderOrg/ubuntu-on-android \
45-
| tail -n1 | cut -d / -f 3 | cut -d v -f 2- )
46-
udroid_download=$(
47-
git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' \
48-
https://github.com/RandomCoderOrg/udroid-download \
49-
| tail -n1 | cut -d / -f 3
50-
)
51-
echo "VERSIONTAG=V${udroid_version}${BUILD_TYPE}PR$((${udroid_download: -2} + 1))" >> $GITHUB_ENV
43+
pip3 install requests
44+
sudo python3 /home/runner/work/udroid-download/udroid-download/.github/scripts/compute-release-tag.py
45+
5246
- name: Generate release notes
5347
run: sudo bash /home/runner/work/udroid-download/udroid-download/.github/scripts/generate-release-notes.sh
5448
- name: Create Release

0 commit comments

Comments
 (0)