Release Deployment #20
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: Release Deployment | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: deploy-release | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 21 | |
| distribution: "temurin" | |
| cache: gradle | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Run Android Lint | |
| run: ./gradlew lintRelease --no-daemon | |
| - name: Run Unit Tests | |
| run: ./gradlew testDebugUnitTest --no-daemon | |
| - name: Build Bundle | |
| run: ./gradlew bundleRelease --no-daemon --parallel --build-cache | |
| - name: Sign bundle for Google Play release | |
| uses: r0adkll/sign-android-release@v1 | |
| with: | |
| releaseDirectory: app/build/outputs/bundle/release | |
| signingKeyBase64: ${{ secrets.SIGNING_KEY }} | |
| alias: ${{ secrets.ALIAS }} | |
| keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} | |
| keyPassword: ${{ secrets.KEY_PASSWORD }} | |
| env: | |
| BUILD_TOOLS_VERSION: "34.0.0" | |
| - name: Upload bundle to artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: google-play-bundle | |
| path: app/build/outputs/bundle/release/app-release.aab | |
| publish: | |
| needs: ["build"] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Download bundle from artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: google-play-bundle | |
| path: . | |
| - name: Create service_account.json for Google Play release | |
| env: | |
| SERVICE_ACCOUNT_JSON: ${{ secrets.SERVICE_ACCOUNT_JSON }} | |
| run: printf '%s' "$SERVICE_ACCOUNT_JSON" > service_account.json | |
| - name: Publish bundle to Google Play | |
| uses: r0adkll/upload-google-play@v1.1.3 | |
| with: | |
| serviceAccountJson: service_account.json | |
| packageName: com.doubleangels.redact | |
| releaseFiles: app-release.aab | |
| track: production | |
| whatsNewDirectory: whatsnew | |
| - name: Set up Ruby for Fastlane | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "3.3" | |
| - name: Install Fastlane | |
| run: gem install fastlane | |
| - name: Push Fastlane metadata to Play Store | |
| run: fastlane supply --skip_upload_apk true --skip_upload_aab true --json_key service_account.json --package_name com.doubleangels.redact --track production | |
| delete-workflow-runs: | |
| permissions: | |
| actions: write | |
| needs: ["build", "publish"] | |
| runs-on: ubuntu-latest | |
| if: always() | |
| steps: | |
| - name: Delete workflow runs | |
| uses: Mattraks/delete-workflow-runs@v2.1.0 | |
| with: | |
| token: ${{ github.token }} | |
| repository: ${{ github.repository }} | |
| retain_days: 30 | |
| keep_minimum_runs: 5 |