Skip to content

Commit 46ac54f

Browse files
authored
Merge pull request #4 from aubynsamuel/test
patch apk signing error fixes
2 parents 13d0def + 69164a6 commit 46ac54f

2 files changed

Lines changed: 21 additions & 26 deletions

File tree

.github/workflows/android-build.yml

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
steps:
2323
- name: Checkout code
2424
uses: actions/checkout@v4
25-
25+
2626
- name: Check if this is a release
2727
id: check-release
2828
run: |
@@ -31,7 +31,7 @@ jobs:
3131
else
3232
echo "is-release=false" >> $GITHUB_OUTPUT
3333
fi
34-
34+
3535
- name: Get version
3636
id: get-version
3737
run: |
@@ -41,13 +41,13 @@ jobs:
4141
else
4242
echo "version=test-${{ github.sha }}" >> $GITHUB_OUTPUT
4343
fi
44-
44+
4545
- name: Set up JDK ${{ env.JAVA_VERSION }}
4646
uses: actions/setup-java@v4
4747
with:
4848
distribution: ${{ env.JAVA_DISTRIBUTION }}
4949
java-version: ${{ env.JAVA_VERSION }}
50-
50+
5151
- name: Cache Gradle packages
5252
uses: actions/cache@v4
5353
with:
@@ -57,10 +57,10 @@ jobs:
5757
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
5858
restore-keys: |
5959
gradle-${{ runner.os }}-
60-
60+
6161
- name: Grant execute permission for gradlew
6262
run: chmod +x ./gradlew
63-
63+
6464
- name: Validate Gradle wrapper
6565
uses: gradle/wrapper-validation-action@v2
6666

@@ -75,19 +75,19 @@ jobs:
7575
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
7676
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
7777
KEYSTORE_FILE: ${{ secrets.KEYSTORE_FILE }}
78-
78+
7979
- name: Build unsigned test APK
8080
if: steps.check-release.outputs.is-release == 'false'
8181
run: |
8282
echo "Building unsigned test APK..."
8383
./gradlew :app:assembleBenchmarkRelease
84-
84+
8585
- name: Setup keystore for signing (Release only)
8686
if: steps.check-release.outputs.is-release == 'true'
8787
run: |
8888
echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 --decode > keystore.jks
8989
echo "Keystore file created"
90-
90+
9191
- name: Sign APK (Release only)
9292
if: steps.check-release.outputs.is-release == 'true'
9393
run: |
@@ -116,13 +116,7 @@ jobs:
116116
fi
117117
118118
# Sign the APK
119-
"$APKSIGNER_PATH" sign \
120-
--ks keystore.jks \
121-
--ks-key-alias "${{ secrets.KEY_ALIAS }}" \
122-
--ks-pass pass:"${{ secrets.KEYSTORE_PASSWORD }}" \
123-
--key-pass pass:"${{ secrets.KEY_PASSWORD }}" \
124-
--out "${APK_FILE%.apk}-signed.apk" \
125-
"$APK_FILE"
119+
"$APKSIGNER_PATH" sign --ks keystore.jks --ks-key-alias "${{ secrets.KEY_ALIAS }}" --ks-pass pass:"${{ secrets.KEYSTORE_PASSWORD }}" --key-pass pass:"${{ secrets.KEY_PASSWORD }}" --out "${APK_FILE%.apk}-signed.apk" "$APK_FILE"
126120
127121
# Verify the signature
128122
"$APKSIGNER_PATH" verify "${APK_FILE%.apk}-signed.apk"
@@ -131,7 +125,7 @@ jobs:
131125
132126
# Replace unsigned APK with signed one
133127
mv "${APK_FILE%.apk}-signed.apk" "$APK_FILE"
134-
128+
135129
- name: Rename APK with version
136130
run: |
137131
APK_FILE=$(find app/build/outputs/apk/benchmarkRelease -name "*.apk" | head -1)
@@ -154,29 +148,29 @@ jobs:
154148
echo "APK renamed to: $NEW_NAME"
155149
echo "apk-path=$APK_DIR/$NEW_NAME" >> $GITHUB_OUTPUT
156150
id: rename-apk
157-
151+
158152
- name: Get APK info
159153
run: |
160154
APK_FILE=$(find app/build/outputs/apk/benchmarkRelease -name "*.apk" | head -1)
161155
if [ -n "$APK_FILE" ]; then
162156
echo "APK Size: $(du -h "$APK_FILE" | cut -f1)"
163157
echo "APK Path: $APK_FILE"
164-
158+
165159
# Get APK details using aapt if available
166160
if command -v aapt >/dev/null 2>&1; then
167161
echo "APK Package Info:"
168162
aapt dump badging "$APK_FILE" | grep -E "package:|application-label:|platformBuildVersionName"
169163
fi
170164
fi
171-
165+
172166
- name: Cleanup keystore
173167
if: always() && steps.check-release.outputs.is-release == 'true'
174168
run: |
175169
if [ -f keystore.jks ]; then
176170
rm -f keystore.jks
177171
echo "Keystore file cleaned up"
178172
fi
179-
173+
180174
- name: Upload APK artifact
181175
uses: actions/upload-artifact@v4
182176
with:
@@ -196,7 +190,7 @@ jobs:
196190
with:
197191
name: clipsync-android-${{ needs.build.outputs.version }}
198192
path: ./apk/
199-
193+
200194
- name: List test artifacts
201195
run: |
202196
echo "Test build artifacts:"
@@ -214,7 +208,7 @@ jobs:
214208
with:
215209
name: clipsync-android-${{ needs.build.outputs.version }}
216210
path: ./apk/
217-
211+
218212
- name: Verify release artifacts
219213
run: |
220214
echo "Release artifacts:"
@@ -226,7 +220,7 @@ jobs:
226220
else
227221
echo "Signed APK found for release"
228222
fi
229-
223+
230224
- name: Create GitHub Release
231225
uses: softprops/action-gh-release@v2
232226
with:

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@
1515
.externalNativeBuild
1616
.cxx
1717
local.properties
18-
# gradlew
19-
# gradle/wrapper/gradle-wrapper.jar
18+
keystore_base64.txt
19+
release-key.jks
20+
app/benchmarkRelease

0 commit comments

Comments
 (0)