From 861e87e0724f439186ec3f693719c66bfcc47883 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Wed, 20 May 2026 21:32:33 +0000 Subject: ci: standardize workflow to canonical template, remove vestigial appdistribution plugin Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/android.yml | 111 +++++++++++++++++++++++------------------- 1 file changed, 60 insertions(+), 51 deletions(-) (limited to '.github') diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 7e68aed..80b025b 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -1,68 +1,77 @@ name: Android CI/CD +# ── Per-project config ──────────────────────────────────────── +env: + ANDROID_DIR: android-app + APP_NAME: nav +# ───────────────────────────────────────────────────────────── + on: push: - branches: [ main, claude/** ] + branches: [ main, "claude/**" ] pull_request: branches: [ main ] + workflow_dispatch: jobs: build: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + + - uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: temurin + cache: gradle + + - name: Accept SDK licenses + run: yes | ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null 2>&1 || true + + - name: Grant gradlew permission + run: chmod +x ${{ env.ANDROID_DIR }}/gradlew + + - name: Compute version + run: | + COMMIT_SHORT=$(git rev-parse --short HEAD) + COMMIT_MSG=$(git log -1 --pretty=format:'%s' | cut -c1-60) + VN="1.0.${{ github.run_number }} (${COMMIT_SHORT} ${COMMIT_MSG})" + printf '\nbuildVersionCode=${{ github.run_number }}\nbuildVersionName=%s\n' "$VN" >> ${{ env.ANDROID_DIR }}/gradle.properties + echo "BUILD_VERSION_NAME=${VN}" >> $GITHUB_ENV - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' - cache: gradle + - name: Build debug APK + run: ./gradlew assembleDebug --no-daemon + working-directory: ${{ env.ANDROID_DIR }} - - name: Grant execute permission for gradlew - run: chmod +x android-app/gradlew + - name: Distribute to testers + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + uses: wzieba/Firebase-Distribution-Github-Action@v1 + with: + appId: ${{ secrets.FIREBASE_APP_ID }} + serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }} + groups: testers + releaseNotes: ${{ env.BUILD_VERSION_NAME }} + file: ${{ env.ANDROID_DIR }}/app/build/outputs/apk/debug/app-debug.apk - - name: Compute version - run: | - COMMIT_SHORT=$(git rev-parse --short HEAD) - COMMIT_MSG=$(git log -1 --pretty=format:'%s' | cut -c1-60) - VN="1.0.${{ github.run_number }} (${COMMIT_SHORT} ${COMMIT_MSG})" - printf '\nbuildVersionCode=${{ github.run_number }}\nbuildVersionName=%s\n' "$VN" >> android-app/gradle.properties - echo "BUILD_VERSION_NAME=${VN}" >> $GITHUB_ENV + - name: Upload debug artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ env.APP_NAME }}-debug + path: ${{ env.ANDROID_DIR }}/app/build/outputs/apk/debug/app-debug.apk + retention-days: 3 - - name: Build with Gradle - run: ./gradlew assembleDebug - working-directory: android-app + - name: Build release APK + run: ./gradlew assembleRelease --no-daemon + working-directory: ${{ env.ANDROID_DIR }} - - name: upload artifact to Firebase App Distribution - if: github.ref == 'refs/heads/main' && github.event_name == 'push' - uses: wzieba/Firebase-Distribution-Github-Action@v1 - with: - appId: ${{secrets.FIREBASE_APP_ID}} - serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }} - groups: testers - releaseNotes: "${{ env.BUILD_VERSION_NAME }}" - file: android-app/app/build/outputs/apk/debug/app-debug.apk + - name: Upload release artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ env.APP_NAME }}-release-unsigned + path: ${{ env.ANDROID_DIR }}/app/build/outputs/apk/release/app-release-unsigned.apk + retention-days: 3 - - name: Notify claudomator - if: always() - env: - CLAUDOMATOR_WEBHOOK_URL: ${{ secrets.CLAUDOMATOR_WEBHOOK_URL }} - CLAUDOMATOR_WEBHOOK_SECRET: ${{ secrets.CLAUDOMATOR_WEBHOOK_SECRET }} - run: | - PAYLOAD=$(jq -n \ - --arg action "completed" \ - --arg conclusion "${{ job.status }}" \ - --arg name "${{ github.workflow }}" \ - --arg repo "${{ github.repository }}" \ - --arg sha "${{ github.sha }}" \ - --arg run_id "${{ github.run_id }}" \ - '{action: $action, workflow_run: {conclusion: $conclusion, name: $name, head_sha: $sha, id: ($run_id | tonumber)}, repository: {full_name: $repo}}') - SIG=$(printf '%s' "$PAYLOAD" | openssl dgst -sha256 -hmac "$CLAUDOMATOR_WEBHOOK_SECRET" | awk '{print $2}') - curl -sf -X POST \ - -H "Content-Type: application/json" \ - -H "X-GitHub-Event: workflow_run" \ - -H "X-Hub-Signature-256: sha256=${SIG}" \ - "${CLAUDOMATOR_WEBHOOK_URL}/api/webhooks/github" \ - -d "$PAYLOAD" + # ── Claudomator ── uncomment when wired up ───────────── + # - name: Notify claudomator + # if: always() + # ... -- cgit v1.2.3