feat: deterministic sync progress indicator + related housekeeping #184
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: Snapshot Build | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - feature/** | |
| - enhancement/** | |
| - fix/** | |
| - chore/** | |
| - claude/** | |
| - codex/** | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| inputs: | |
| build_type: | |
| description: 'Build type' | |
| required: false | |
| default: 'release' | |
| type: choice | |
| options: | |
| - release | |
| - debug | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true' | |
| concurrency: | |
| group: snapshot-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-snapshot: | |
| if: >- | |
| github.event_name == 'workflow_dispatch' || | |
| github.event_name == 'pull_request' || | |
| github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Setup JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 17 | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Setup Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Set Build Vars | |
| id: build_vars | |
| run: | | |
| BUILD_TYPE="${{ github.event.inputs.build_type || 'release' }}" | |
| if [ "$BUILD_TYPE" = "debug" ]; then | |
| echo "GRADLE_TASK=assembleGithubSnapshotDebug" >> "$GITHUB_OUTPUT" | |
| echo "APK_DIR=debug" >> "$GITHUB_OUTPUT" | |
| echo "VERSION_SUFFIX=-debug" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "GRADLE_TASK=assembleGithubSnapshotRelease" >> "$GITHUB_OUTPUT" | |
| echo "APK_DIR=release" >> "$GITHUB_OUTPUT" | |
| echo "VERSION_SUFFIX=" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Decode Keystore | |
| if: steps.build_vars.outputs.APK_DIR == 'release' | |
| run: | | |
| echo "${{ secrets.SIGNING_KEY }}" | base64 --decode > ${{ github.workspace }}/keystore.jks | |
| - name: Set Version Vars | |
| id: set_env | |
| run: | | |
| echo "TIMESTAMP=$(date +%Y%m%dT%H%M%S)" >> "$GITHUB_OUTPUT" | |
| echo "COMMIT_SHA=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" | |
| - name: Build Snapshot APK | |
| run: ./gradlew ${{ steps.build_vars.outputs.GRADLE_TASK }} | |
| env: | |
| SNAPSHOT_VERSION_NAME: ${{ steps.set_env.outputs.TIMESTAMP }}-${{ steps.set_env.outputs.COMMIT_SHA }}${{ steps.build_vars.outputs.VERSION_SUFFIX }} | |
| KEY_ALIAS: ${{ secrets.ALIAS }} | |
| KEYSTORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }} | |
| KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
| KEYSTORE: ${{ github.workspace }}/keystore.jks | |
| - name: Create Checksum | |
| id: create_checksum | |
| run: | | |
| FILENAME=$(echo app/build/outputs/apk/githubSnapshot/${{ steps.build_vars.outputs.APK_DIR }}/*.apk) | |
| sha256sum $FILENAME > checksums.txt | |
| echo "ARTIFACT_FILENAME=$FILENAME" >> "$GITHUB_OUTPUT" | |
| # Every run produces a tester-downloadable snapshot artifact. | |
| - name: Upload Snapshot Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: tester-snapshot-${{ steps.build_vars.outputs.APK_DIR }} | |
| path: | | |
| ${{ steps.create_checksum.outputs.ARTIFACT_FILENAME }} | |
| checksums.txt | |
| retention-days: 7 | |
| publish-latest-snapshot: | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| needs: build-snapshot | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download Snapshot Artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: tester-snapshot-release | |
| path: ./artifacts | |
| - name: Update Latest Snapshot Release | |
| uses: joutvhu/create-tag@v1 | |
| with: | |
| tag_name: latest-snapshot | |
| tag_sha: ${{ github.sha }} | |
| message: latest-snapshot | |
| on_tag_exists: update | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Publish to GitHub Releases | |
| uses: ncipollo/release-action@v1.16.0 | |
| with: | |
| allowUpdates: true | |
| prerelease: true | |
| name: MyDeck Continuous Snapshot | |
| body: | | |
| This is an automated snapshot build from the `main` branch. It is a **Release-optimized** build but uses a separate package ID so it can be installed alongside your production version. | |
| **Last updated from:** ${{ github.sha }} | |
| commit: ${{ github.sha }} | |
| tag: latest-snapshot | |
| removeArtifacts: true | |
| omitDraftDuringUpdate: true | |
| artifacts: "./artifacts/*.apk,./artifacts/checksums.txt" | |
| token: ${{ secrets.GITHUB_TOKEN }} |