Stamp the APK's version once per run, not once per Gradle invocation

2514c08 · Gabriel Morell · 2026-09-18 14:57

3 files +12 -0
Message
{commit_body(@commit)}

Files changed

modified .forgejo/workflows/build.yml
+12 −0
@@ -227,9 +227,21 @@ jobs:
227 227
228 228 - name: Build and sign the APK
229 229 if: steps.keystore.outputs.skip != 'true'
230 + env:
231 + RUN_NUMBER: ${{ github.run_number }}
230 232 run: |
233 + set -euo pipefail
234 +
235 + # One stamp for the whole run, computed here rather than
236 + # inside Gradle, so every artifact a run produces agrees on
237 + # its version even if the build is retried a step at a time.
238 + stamp=$(date -u +%s)
239 + echo "version: 0.1.0-dev-$stamp (versionCode $RUN_NUMBER)"
240 +
231 241 docker buildx build \
232 242 --target android-export \
243 + --build-arg GITHUB_RUN_NUMBER="$RUN_NUMBER" \
244 + --build-arg SOURCE_DATE_EPOCH="$stamp" \
233 245 --secret id=keystore,src=./release.jks \
234 246 --secret id=keystore_password,src=./keystore.pass \
235 247 --output type=local,dest=./apk \

Parents: 7d9322a