1818 build_apks :
1919 # Job to build APKs for the latest commit and the commit that triggered the workflow
2020 name : Build APKs
21- runs-on : ubuntu-latest
22- strategy :
23- matrix :
24- # Run matrix for latest commit on branch and current commit SHA
25- commit : ["latest", "${{ github.sha }}"]
26-
27- env :
28- BUILD_TOOLS_VERSION : " 34.0.0"
29-
30- steps :
31- # Checkout the specific commit from matrix
32- - name : Checkout specific commit
33- uses : actions/checkout@v5
34- with :
35- ref : ${{ matrix.commit }}
36-
37- # Set up Java JDK required for Gradle
38- - name : Set up JDK
39- uses : actions/setup-java@v5
40- with :
41- distribution : temurin
42- java-version : ' 17'
43-
44- # Set up Android SDK and build tools
45- - name : Set up Android SDK
46- uses : android-actions/setup-android@v2
47-
48- # Cache Gradle dependencies to speed up builds
49- - name : Cache Gradle
50- uses : actions/cache@v4
51- with :
52- path : |
53- ~/.gradle/caches
54- ~/.gradle/wrapper
55- key : ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
56- restore-keys : |
57- ${{ runner.os }}-gradle-
58-
59- # Build the APK
60- - name : Build APK
61- run : ./gradlew assembleqaRelease --no-daemon --stacktrace --info
62-
63- # Copy the built APK to a commit-specific name
64- - name : Get apk
65- run : cp owncloudApp/build/outputs/apk/qa/release/owncloud_*-qa-release*.apk owncloud-${{ matrix.commit }}.apk
66-
67- # Decode keystore from secret for signing
68- - name : Restore keystore
69- run : |
70- echo "${{ secrets.TEST_KS_B64 }}" | base64 -d > ./test.keystore
71-
72- # Align and sign the APK
73- - name : Sign APK
74- run : |
75- APK_INPUT="owncloud-${{ matrix.commit }}.apk"
76- APK_ALIGNED="owncloud-${{ matrix.commit }}-aligned.apk"
77- APK_SIGNED="owncloudSigned-${{ matrix.commit }}.apk"
78- KEYSTORE="./test.keystore"
79- KEY_ALIAS="${{ secrets.TEST_KS_ALIAS }}"
80- KEY_PASSWORD="${{ secrets.TEST_KS_KEY }}"
81-
82- # Align APK for optimal performance
83- echo "Aligning APK..."
84- $ANDROID_SDK_ROOT/build-tools/${{ env.BUILD_TOOLS_VERSION }}/zipalign -v -p 4 "$APK_INPUT" "$APK_ALIGNED"
85-
86- # Sign APK using keystore
87- echo "Signing APK..."
88- $ANDROID_SDK_ROOT/build-tools/${{ env.BUILD_TOOLS_VERSION }}/apksigner sign \
89- --ks "$KEYSTORE" \
90- --ks-pass pass:"$KEY_PASSWORD" \
91- --key-pass pass:"$KEY_PASSWORD" \
92- --ks-key-alias "$KEY_ALIAS" \
93- --out "$APK_SIGNED" \
94- "$APK_ALIGNED"
95-
96- echo "Signed APK: $APK_SIGNED"
97-
98- # Clean up temporary files
99- rm -f "$APK_ALIGNED"
100- rm -f ./test.keystore
101-
102- # Upload the signed APK as an artifact
103- - name : Upload APK as artifact
104- uses : actions/upload-artifact@v4
105- with :
106- name : owncloudSigned-${{ matrix.commit }}
107- path : ./owncloudSigned-${{ matrix.commit }}.apk
108- # Removed after 1 day
109- retention-days : 1
21+ uses : ./.github/workflows/buildsignedapk.yml
22+ with :
23+ ref : ${{ github.sha }}
11024
11125 execute_tests :
11226 # Job to run tests using the APKs built in previous job
@@ -127,10 +41,11 @@ jobs:
12741 - name : Clone tests repo
12842 run : git clone https://github.com/owncloud/android-update-testing.git .
12943
130- # Download APK built from latest commit
131- - name : Get apk built from latest
132- uses : actions/ download-artifact@v4
44+ # Download APK built last latest signing
45+ - name : Download latest signed APK
46+ uses : dawidd6/action- download-artifact@v3
13347 with :
48+ workflow : Build apk from latest
13449 name : owncloudSigned-latest
13550 path : ./src/test/resources
13651
@@ -221,7 +136,7 @@ jobs:
221136 if : always()
222137 run : zip -r -9 test-recording.zip video || true
223138
224- # Upload video file
139+ # Upload video file
225140 - name : Upload Video
226141 if : always()
227142 uses : actions/upload-artifact@v4
0 commit comments