v2.39.3 #121
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: Play Release | |
| # Fires whenever a GitHub Release is published from the AGENTS.md release flow | |
| # (`gh release create vX.Y.Z --generate-notes`). Both regular releases and | |
| # prereleases (`--prerelease`) trigger the build. Prerelease tags or | |
| # prerelease version names are forced to internal testers only, even if the | |
| # GitHub Release metadata is wrong. | |
| on: | |
| release: | |
| types: [published] | |
| permissions: | |
| contents: read | |
| jobs: | |
| publish-play: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Check out released tag | |
| uses: actions/checkout@v6 | |
| with: | |
| # Checkout the exact tag the release was published from so | |
| # `gitVersionCode = rev-list --count HEAD` matches what was tagged. | |
| ref: ${{ github.event.release.tag_name }} | |
| fetch-depth: 0 | |
| - name: Validate release channel | |
| id: release-channel | |
| shell: bash | |
| run: | | |
| TAG="${{ github.event.release.tag_name }}" | |
| IS_GITHUB_PRERELEASE="${{ github.event.release.prerelease }}" | |
| VERSION_NAME="$(grep -E 'versionName = "' app/build.gradle.kts | sed -E 's/.*versionName = "([^"]+)".*/\1/')" | |
| IS_SEMANTIC_PRERELEASE="false" | |
| if [[ "$TAG" =~ -(alpha|beta|rc)(\.|$) ]] || [[ "$VERSION_NAME" =~ -(alpha|beta|rc)(\.|$) ]]; then | |
| IS_SEMANTIC_PRERELEASE="true" | |
| fi | |
| if [[ "$IS_SEMANTIC_PRERELEASE" == "true" ]]; then | |
| echo "play_tracks=internal" >> "$GITHUB_OUTPUT" | |
| if [[ "$IS_GITHUB_PRERELEASE" != "true" ]]; then | |
| echo "::error::Prerelease tag or version detected (tag: $TAG, versionName: $VERSION_NAME), but the GitHub Release is not marked as a prerelease." | |
| exit 1 | |
| fi | |
| exit 0 | |
| fi | |
| if [[ "$IS_GITHUB_PRERELEASE" == "true" ]]; then | |
| echo "play_tracks=internal" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| echo "play_tracks=internal,production" >> "$GITHUB_OUTPUT" | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: jetbrains | |
| java-version: '21' | |
| - name: Set up Gradle | |
| uses: gradle/actions/setup-gradle@v6 | |
| - name: Decode upload keystore | |
| run: | | |
| echo "${{ secrets.UPLOAD_KEYSTORE_BASE64 }}" \ | |
| | base64 --decode > "$RUNNER_TEMP/upload.jks" | |
| - name: Build signed release AAB | |
| env: | |
| UPLOAD_KEYSTORE_PATH: ${{ runner.temp }}/upload.jks | |
| UPLOAD_KEYSTORE_PASSWORD: ${{ secrets.UPLOAD_KEYSTORE_PASSWORD }} | |
| UPLOAD_KEY_ALIAS: ${{ secrets.UPLOAD_KEY_ALIAS }} | |
| UPLOAD_KEY_PASSWORD: ${{ secrets.UPLOAD_KEY_PASSWORD }} | |
| REVENUECAT_PUBLIC_KEY: ${{ secrets.REVENUECAT_PUBLIC_KEY }} | |
| TIMBERLOGS_API_KEY: ${{ secrets.TIMBERLOGS_API_KEY }} | |
| SUPABASE_URL: ${{ secrets.SUPABASE_URL }} | |
| SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY }} | |
| GOOGLE_WEB_CLIENT_ID: ${{ secrets.GOOGLE_WEB_CLIENT_ID }} | |
| AI_MODEL_URL: ${{ secrets.AI_MODEL_URL }} | |
| run: ./gradlew bundleRelease --no-daemon --max-workers=2 -Dorg.gradle.jvmargs="-Xmx5g -Dfile.encoding=UTF-8" | |
| # Single upload that targets one or more Play tracks. The tracks are | |
| # computed by Validate release channel so beta/alpha/rc builds cannot | |
| # reach production if release metadata is set incorrectly. | |
| - name: Upload to Play Store | |
| uses: r0adkll/upload-google-play@v1 | |
| with: | |
| serviceAccountJsonPlainText: ${{ secrets.PLAY_SERVICE_ACCOUNT_JSON }} | |
| packageName: com.enaboapps.switchify | |
| releaseFiles: app/build/outputs/bundle/release/app-release.aab | |
| tracks: ${{ steps.release-channel.outputs.play_tracks }} | |
| status: completed | |
| releaseName: ${{ github.event.release.tag_name }} | |
| - name: Clean up keystore | |
| if: always() | |
| run: rm -f "$RUNNER_TEMP/upload.jks" |