1+ name : moonlight-android
2+
3+ on : [push, pull_request]
4+
5+ jobs :
6+ build :
7+ name : Build
8+ runs-on : ubuntu-latest
9+
10+ steps :
11+ - uses : android-actions/setup-android@v3
12+ with :
13+ cmdline-tools-version : 9477386
14+
15+ - uses : actions/setup-java@v4
16+ with :
17+ java-version : 21
18+ distribution : ' adopt'
19+
20+ - name : Set up environment
21+ run : |
22+ echo "ANDROID_NDK_HOME=$ANDROID_NDK_HOME" >> $GITHUB_ENV
23+ echo "ANDROID_SDK_ROOT=$ANDROID_HOME" >> $GITHUB_ENV
24+ echo "COMMIT_PREFIX=$(echo ${{ github.sha }} | cut -c1-8)" >> $GITHUB_ENV
25+
26+ - name : Checkout moonlight-android repo
27+ uses : actions/checkout@v4
28+ with :
29+ fetch-depth : 0
30+
31+ - name : Decode debug keystore
32+ env :
33+ DEBUG_KEYSTORE : ${{ secrets.DEBUG_KEYSTORE }}
34+ run : |
35+ if [ -z "$DEBUG_KEYSTORE" ]
36+ then
37+ echo "No debug keystore value"
38+ else
39+ echo $DEBUG_KEYSTORE > debug.keystore.base64
40+ base64 --decode debug.keystore.base64 > debug.keystore
41+ sudo cp -f debug.keystore /root/.android/.
42+ fi
43+
44+ - name : Install build dependencies
45+ run : |
46+ git submodule update --init --recursive
47+
48+ - name : Build artifact
49+ run : ./gradlew assemble
50+
51+ - name : Copy artifact
52+ run : |
53+ mkdir moonlight-android
54+ cp app/build/outputs/apk/root/debug/app-root-debug.apk "moonlight-android/app-root-debug-${COMMIT_PREFIX}.apk"
55+ cp app/build/outputs/apk/nonRoot/debug/app-nonRoot-debug.apk "moonlight-android/app-nonRoot-debug-${COMMIT_PREFIX}.apk"
56+
57+ - name : Upload artifact
58+ uses : actions/upload-artifact@v4
59+ with :
60+ name : moonlight-android
61+ path : ${{ github.workspace }}/moonlight-android
62+
63+ release :
64+ name : Release
65+ runs-on : ubuntu-latest
66+ needs : [build]
67+ if : github.ref == 'refs/heads/master'
68+
69+ steps :
70+ - name : Checkout moonlight-android repo
71+ uses : actions/checkout@v4
72+ with :
73+ fetch-depth : 0
74+
75+ - name : Download Artifacts
76+ uses : actions/download-artifact@v4
77+ with :
78+ path : dist
79+ merge-multiple : true
80+
81+ - name : Re-zip artifacts
82+ run : |
83+ cd dist
84+ COMMIT_PREFIX=$(echo ${{ github.sha }} | cut -c1-8)
85+ for artifact in *.apk
86+ do
87+ file_name="${artifact%.apk}"
88+ echo "-> Creating ${file_name//-${COMMIT_PREFIX}/}.zip"
89+ zip "${file_name//-${COMMIT_PREFIX}/}.zip" "${file_name}.apk"
90+ done
91+
92+ - name : Update Git Tag
93+ run : |
94+ git tag -f Pre-release
95+ git push -f origin Pre-release
96+
97+ - name : Create Release
98+ uses : ncipollo/release-action@v1
99+ with :
100+ prerelease : true
101+ allowUpdates : true
102+ removeArtifacts : true
103+ replacesArtifacts : false
104+ tag : Pre-release
105+ artifacts : " dist/*.zip"
0 commit comments