1- name : Android CI
2-
3- on :
4- push :
5- branches : [ "**" ]
6- paths-ignore :
7- - ' **/*.md'
8- pull_request :
9- branches : [ "**" ]
10- paths-ignore :
11- - ' **/*.md'
12- workflow_dispatch :
13-
14- jobs :
15- init :
16- name : Init
17- runs-on : ubuntu-latest
18- environment : Release
19- steps :
20- - name : Checkout code
21- uses : actions/checkout@v4
22-
23- - name : notify telegram
24- if : github.event_name != 'pull_request'
25- uses : EverythingSuckz/github-telegram-notify@main
26- continue-on-error : true
27- with :
28- bot_token : ${{ secrets.BOT_TOKEN }}
29- chat_id : ${{ secrets.CHAT_ID }}
30- topic_id : 4
31-
32- build_preview_apk :
33- name : Build App Preview APKs
34- runs-on : ubuntu-latest
35- env :
36- TG_BOT_TOKEN : ${{ secrets.BOT_TOKEN }}
37- TG_CHAT_ID : ${{ secrets.CHAT_ID }}
38- LOG_CHAT_ID : ${{ secrets.LOG_CHAT_ID }}
39- KEYSTORE_BASE64 : ${{ secrets.KEYSTORE_BASE64 }}
40- KEYSTORE_PASSWORD : ${{ secrets.KEYSTORE_PASSWORD }}
41- KEY_ALIAS : ${{ secrets.KEY_ALIAS }}
42- ALIAS_PASSWORD : ${{ secrets.ALIAS_PASSWORD }}
43- environment : MainEnv
44- steps :
45- - name : Check out repository
46- uses : actions/checkout@v4
47-
48- - name : Set up JDK 21
49- uses : actions/setup-java@v4
50- with :
51- java-version : ' 21'
52- distribution : ' oracle'
53- cache : gradle
54-
55- - name : Grant execute permission for gradlew
56- run : chmod +x gradlew
57-
58- - name : Validate Gradle wrapper
59- uses : gradle/actions/wrapper-validation@v4
60-
61- - name : Build Preview build for both ABIs
62- if : github.event_name != 'pull_request'
63- run : |
64- ./gradlew assemblePreview \
65- -DLOG_CHAT_ID="${{ secrets.LOG_CHAT_ID }}" \
66- -DTG_BOT_TOKEN="${{ secrets.BOT_TOKEN }}" \
67- -DTG_CHAT_ID="${{ secrets.CHAT_ID }}" \
68- -DKEYSTORE_BASE64="${{ secrets.KEYSTORE_BASE64 }}" \
69- -DKEYSTORE_PASSWORD="${{ secrets.KEYSTORE_PASSWORD }}" \
70- -DKEY_ALIAS="${{ secrets.KEY_ALIAS }}" \
71- -DALIAS_PASSWORD="${{ secrets.ALIAS_PASSWORD }}"
72-
73- - name : Rename APKs with commit hash
74- run : |
75- HASH=${GITHUB_SHA::8}
76- mv app/build/outputs/apk/preview/app-arm64-v8a-preview.apk app/build/outputs/apk/preview/preview-arm64-v8a-${HASH}.apk
77- mv app/build/outputs/apk/preview/app-armeabi-v7a-preview.apk app/build/outputs/apk/preview/preview-armeabi-v7a-${HASH}.apk
78-
79- - name : Upload preview arm64 apk
80- uses : actions/upload-artifact@v4
81- with :
82- name : preview-arm64
83- path : app/build/outputs/apk/preview/preview-arm64-v8a-*.apk
84-
85- - name : Upload preview armeabi apk
86- uses : actions/upload-artifact@v4
87- with :
88- name : preview-armeabi
89- path : app/build/outputs/apk/preview/preview-armeabi-v7a-*.apk
90-
91- send_preview_apks :
92- name : Send Preview APKs
93- runs-on : ubuntu-latest
94- needs : build_preview_apk
95- environment : Release
96- if : github.ref == 'refs/heads/preview' && github.event_name != 'pull_request'
97- steps :
98- - name : Download arm64 apk
99- uses : actions/download-artifact@v4
100- with :
101- name : preview-arm64
102- path : .
103-
104- - name : Download armeabi apk
105- uses : actions/download-artifact@v4
106- with :
107- name : preview-armeabi
108- path : .
109-
110- - name : Send arm64 APK to Telegram
111- if : success()
112- continue-on-error : true
113- run : |
114- HASH=${GITHUB_SHA::8}
115- curl -X POST "https://api.telegram.org/bot${{ secrets.BOT_TOKEN }}/sendDocument" \
116- -F chat_id="${{ secrets.CHAT_ID }}" \
117- -F message_thread_id="4" \
118- -F document=@"preview-arm64-v8a-${HASH}.apk" \
119- -F caption="arm64-v8a Build"
120-
121- - name : Send armeabi APK to Telegram
122- if : success()
123- continue-on-error : true
124- run : |
125- HASH=${GITHUB_SHA::8}
126- curl -X POST "https://api.telegram.org/bot${{ secrets.BOT_TOKEN }}/sendDocument" \
127- -F chat_id="${{ secrets.CHAT_ID }}" \
128- -F message_thread_id="4" \
129- -F document=@"preview-armeabi-v7a-${HASH}.apk" \
130- -F caption="armeabi-v7a Build"
131-
132- update_website :
1+ update_website :
1332 name : Update Website Links
1343 runs-on : ubuntu-latest
1354 needs : build_preview_apk
1409 - name : Checkout code
14110 uses : actions/checkout@v4
14211 with :
12+ ref : ${{ github.ref_name }}
14313 fetch-depth : 0
14414
145- - name : Update HTML placeholders
15+ - name : Update HTML from dummy template
14616 env :
14717 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
14818 run : |
@@ -151,14 +21,15 @@ jobs:
15121 HASH=${GITHUB_SHA::8}
15222 NIGHTLY_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
15323
154- sed -i "s|__STABLE_VERSION__|${LATEST_TAG}|g" download.html
155- sed -i "s|__STABLE_URL__|${LATEST_APK_URL}|g" download.html
156- sed -i "s|__NIGHTLY_HASH__|#${HASH}|g" download.html
157- sed -i "s|__NIGHTLY_URL__|${NIGHTLY_URL}|g" download.html
24+ sed -e "s|__STABLE_VERSION__|${LATEST_TAG}|g" \
25+ -e "s|__STABLE_URL__|${LATEST_APK_URL}|g" \
26+ -e "s|__NIGHTLY_HASH__|#${HASH}|g" \
27+ -e "s|__NIGHTLY_URL__|${NIGHTLY_URL}|g" \
28+ download-dummy.html > download.html
15829
15930 - name : Commit changes
16031 run : |
16132 git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
16233 git config --local user.name "github-actions[bot]"
16334 git add download.html
164- git diff --quiet && git diff --staged --quiet || (git commit -m "chore: update download links [skip ci]" && git push)
35+ git diff --quiet && git diff --staged --quiet || (git commit -m "chore: update download links [skip ci]" && git push origin HEAD:${{ github.ref_name }} )
0 commit comments