Add settings screen and notification features; refactor server URL ha… #9
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build & Publish Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' # Triggers on tags like v1.0, v1.2.3, etc. | |
| workflow_dispatch: # Allows manual trigger from GitHub Actions tab | |
| jobs: | |
| build: | |
| name: Build Signed Release APK | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| # 1. Checkout the repository | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| # 2. Set up JDK 17 (required for AGP 8.x) | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: '17' | |
| # 3. Cache Gradle files to speed up builds | |
| - name: Cache Gradle packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle- | |
| # 4. Make gradlew executable | |
| - name: Grant execute permission to gradlew | |
| run: chmod +x gradlew | |
| # 5. Decode the keystore from the GitHub secret and save it to disk, | |
| # or generate a temporary keystore when the secret is not configured. | |
| - name: Decode keystore | |
| env: | |
| KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }} | |
| run: | | |
| if [ -n "$KEYSTORE_BASE64" ]; then | |
| echo "$KEYSTORE_BASE64" | tr -d '\n' | base64 --decode > app/release.keystore | |
| echo "SIGNING_STORE_PASSWORD=${{ secrets.KEYSTORE_PASSWORD }}" >> $GITHUB_ENV | |
| echo "SIGNING_KEY_ALIAS=${{ secrets.KEY_ALIAS }}" >> $GITHUB_ENV | |
| echo "SIGNING_KEY_PASSWORD=${{ secrets.KEY_PASSWORD }}" >> $GITHUB_ENV | |
| else | |
| echo "KEYSTORE_BASE64 secret not set - generating a temporary keystore for signing" | |
| keytool -genkeypair -v \ | |
| -keystore app/release.keystore \ | |
| -alias release \ | |
| -keyalg RSA \ | |
| -keysize 2048 \ | |
| -validity 10000 \ | |
| -storepass android \ | |
| -keypass android \ | |
| -dname "CN=QueueApp,O=QueueApp,L=Unknown,ST=Unknown,C=US" | |
| echo "SIGNING_STORE_PASSWORD=android" >> $GITHUB_ENV | |
| echo "SIGNING_KEY_ALIAS=release" >> $GITHUB_ENV | |
| echo "SIGNING_KEY_PASSWORD=android" >> $GITHUB_ENV | |
| fi | |
| # 5.5. Verify the keystore file was written correctly | |
| - name: Check keystore file size | |
| run: | | |
| FILE_SIZE=$(stat -c%s "app/release.keystore" 2>/dev/null || echo 0) | |
| echo "Keystore file size: $FILE_SIZE bytes" | |
| if [ "$FILE_SIZE" -eq 0 ]; then | |
| echo "ERROR: Keystore file is empty (0 bytes). The KEYSTORE_BASE64 secret may not be set correctly or the decode failed." | |
| exit 1 | |
| fi | |
| # 6. Verify the keystore is valid before attempting the build | |
| - name: Verify keystore | |
| run: keytool -list -keystore app/release.keystore -storepass "$SIGNING_STORE_PASSWORD" -noprompt | |
| # 7. Build the signed release APK | |
| - name: Build release APK | |
| run: ./gradlew assembleRelease | |
| env: | |
| SIGNING_STORE_FILE: release.keystore | |
| SIGNING_STORE_PASSWORD: ${{ env.SIGNING_STORE_PASSWORD }} | |
| SIGNING_KEY_ALIAS: ${{ env.SIGNING_KEY_ALIAS }} | |
| SIGNING_KEY_PASSWORD: ${{ env.SIGNING_KEY_PASSWORD }} | |
| # 8. Rename the APK to include the version tag | |
| - name: Rename APK | |
| run: | | |
| VERSION=${GITHUB_REF_NAME:-manual} | |
| mv app/build/outputs/apk/release/app-release.apk \ | |
| app/build/outputs/apk/release/QueueApp-${VERSION}.apk | |
| # 9. Upload APK as a build artifact (always available) | |
| - name: Upload APK artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: QueueApp-release | |
| path: app/build/outputs/apk/release/QueueApp-*.apk | |
| # 10. Create a GitHub Release and attach the APK (only when triggered by a tag) | |
| - name: Create GitHub Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: app/build/outputs/apk/release/QueueApp-*.apk | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |