diff --git a/.github/scripts/compute-release-tag.py b/.github/scripts/compute-release-tag.py new file mode 100644 index 0000000..b272323 --- /dev/null +++ b/.github/scripts/compute-release-tag.py @@ -0,0 +1,33 @@ +import os +import json, requests, re + +GITHUB_ENV_PATH = os.getenv("GITHUB_ENV") + +headers = { + "Content-Type": "application/x-www-form-urlencoded" +} + +API_ENDPOINT_UOA="https://api.github.com/repos/RandomCoderOrg/ubuntu-on-android/releases" +resp_uoa = requests.get(API_ENDPOINT_UOA, headers=headers) +Json_data_uoa = json.loads(resp_uoa.text) + +# uV = ["v3.1-alpha"][0] # For testing +udroid_version = Json_data_uoa[0]['tag_name'].replace("v","") + +API_ENDPOINT_UA="https://api.github.com/repos/RandomCoderOrg/udroid-download/releases" +resp_ud = requests.get(API_ENDPOINT_UA, headers=headers) +Json_data_ua = json.loads(resp_ud.text) + + +match = re.compile(r'V(\d+)(\D+)(\d+)').findall(Json_data_ua[0]['tag_name']) +_, RELEASE_TYPE, IterationNumber = match[0] +IterationNumber = int(IterationNumber) + 1 + +BUILD_TYPE="AB" + +Latest_release_tag = "V-%s-%s%s%s" % (udroid_version,BUILD_TYPE,RELEASE_TYPE,IterationNumber) + +with open(GITHUB_ENV_PATH, "a+") as f: + f.write(Latest_release_tag) + +print(Latest_release_tag) \ No newline at end of file diff --git a/.github/workflows/anchor-build-and-release.yml b/.github/workflows/anchor-build-and-release.yml index 78e77a7..212fa7f 100644 --- a/.github/workflows/anchor-build-and-release.yml +++ b/.github/workflows/anchor-build-and-release.yml @@ -41,15 +41,9 @@ jobs: name: raw-tarballs - name: Compute release tag run: | - udroid_version=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' \ - https://github.com/RandomCoderOrg/ubuntu-on-android \ - | tail -n1 | cut -d / -f 3 | cut -d v -f 2- ) - udroid_download=$( - git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' \ - https://github.com/RandomCoderOrg/udroid-download \ - | tail -n1 | cut -d / -f 3 - ) - echo "VERSIONTAG=V${udroid_version}${BUILD_TYPE}PR$((${udroid_download: -2} + 1))" >> $GITHUB_ENV + pip3 install requests + sudo python3 /home/runner/work/udroid-download/udroid-download/.github/scripts/compute-release-tag.py + - name: Generate release notes run: sudo bash /home/runner/work/udroid-download/udroid-download/.github/scripts/generate-release-notes.sh - name: Create Release