-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (69 loc) · 3.31 KB
/
Copy pathgithub-android.yml
File metadata and controls
80 lines (69 loc) · 3.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Required secrets:
# GH_PAT - GitHub PAT to download artifacts and create releases
name: GitHub Release (Android)
on:
workflow_dispatch:
inputs:
run_id:
description: 'AndroidCelestia build run ID (leave empty for latest)'
required: false
branch:
description: 'Branch'
required: true
default: 'develop'
rc:
description: 'RC number'
required: true
default: '1'
jobs:
release:
runs-on: ubuntu-24.04
steps:
- name: Checkout release
uses: actions/checkout@v4
- name: Resolve Run ID
env:
GH_TOKEN: ${{ secrets.GH_PAT }}
run: |
if [ -n "${{ inputs.run_id }}" ]; then
echo "RESOLVED_RUN_ID=${{ inputs.run_id }}" >> $GITHUB_ENV
else
RUN_ID=$(gh api "repos/celestiamobile/AndroidCelestia/actions/workflows/build.yml/runs?branch=${{ inputs.branch }}&status=success&per_page=1" --jq '.workflow_runs[0].id')
echo "RESOLVED_RUN_ID=$RUN_ID" >> $GITHUB_ENV
fi
- name: Download Build
uses: actions/download-artifact@v4
with:
name: apk
run-id: ${{ env.RESOLVED_RUN_ID }}
repository: celestiamobile/AndroidCelestia
github-token: ${{ secrets.GH_PAT }}
path: '${{ runner.temp }}/apk'
- name: Set Version and Tag
run: |
VERSION=$(curl -s "https://raw.githubusercontent.com/celestiamobile/AndroidCelestia/${{ inputs.branch }}/app/src/main/AndroidManifest.xml" | awk -F'"' '/android.versionName=/ {print $2; exit}')
TAG=$(echo $VERSION | sed 's/\./_/g')_rc${{ inputs.rc }}
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "TAG=$TAG" >> $GITHUB_ENV
- name: Rename File
run: mv $RUNNER_TEMP/apk/app-sideload-release-unsigned.apk $RUNNER_TEMP/celestia-${{ env.VERSION }}-rc${{ inputs.rc }}.apk
- name: Update Release Notes
run: |
CELESTIA_REPO_COMMIT=$(git ls-remote https://github.com/celestiamobile/Celestia ${{ inputs.branch }} | cut -f 1)
CELESTIA_LOCALIZATION_REPO_COMMIT=$(git ls-remote https://github.com/celestiamobile/CelestiaLocalization ${{ inputs.branch }} | cut -f 1)
CELESTIA_CONTENT_REPO_COMMIT=$(curl -s "https://raw.githubusercontent.com/celestiamobile/CelestiaUWP/${{ inputs.branch }}/.github/workflows/build.yml" | awk -F"'" '/CONTENT_COMMIT_HASH/ {print $2}')
echo https://github.com/celestiamobile/Celestia/commit/$CELESTIA_REPO_COMMIT >> release-notes-android.txt
echo https://github.com/celestiamobile/CelestiaLocalization/commit/$CELESTIA_LOCALIZATION_REPO_COMMIT >> release-notes-android.txt
echo https://github.com/CelestiaProject/CelestiaContent/commit/$CELESTIA_CONTENT_REPO_COMMIT >> release-notes-android.txt
- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.GH_PAT }}
run: |
COMMIT=$(git ls-remote https://github.com/celestiamobile/AndroidCelestia ${{ inputs.branch }} | cut -f 1)
gh release create ${{ env.TAG }} \
--repo celestiamobile/AndroidCelestia \
--target $COMMIT \
--title "${{ env.VERSION }}" \
--notes-file release-notes-android.txt \
--draft \
$RUNNER_TEMP/celestia-${{ env.VERSION }}-rc${{ inputs.rc }}.apk