|
| 1 | +name: google play console |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + release_tag: |
| 7 | + required: true |
| 8 | + type: string |
| 9 | + gcp_wif_provider: |
| 10 | + description: > |
| 11 | + Full resource name of the Google Cloud Workload Identity Federation |
| 12 | + provider used for GitHub OIDC authentication |
| 13 | + (format: projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/POOL_ID/providers/PROVIDER_ID). |
| 14 | + required: true |
| 15 | + type: string |
| 16 | + gcp_service_account: |
| 17 | + description: > |
| 18 | + Email address of the Google Cloud service account to impersonate via |
| 19 | + Workload Identity Federation. This service account must be granted |
| 20 | + the appropriate permissions in the Google Play Console for uploading |
| 21 | + Android app builds (no static service account keys are used). |
| 22 | + required: true |
| 23 | + type: string |
| 24 | + package_name: |
| 25 | + description: > |
| 26 | + The Android application ID of the app in Google Play (for example, |
| 27 | + 'com.earthmanmuons.whatchord'). This must match the package name used |
| 28 | + when the app was first created in the Play Console. |
| 29 | + required: true |
| 30 | + type: string |
| 31 | + track: |
| 32 | + description: > |
| 33 | + The Google Play release track to which the uploaded app bundle will be |
| 34 | + assigned (such as 'internal', 'alpha', 'beta', or 'production'). |
| 35 | + required: false |
| 36 | + type: string |
| 37 | + default: internal |
| 38 | + release_status: |
| 39 | + description: > |
| 40 | + The release status to apply after uploading the app bundle. |
| 41 | + Use 'draft' to create a draft release in the Play Console for |
| 42 | + manual review and publishing, or 'completed' to publish |
| 43 | + immediately to the selected track. |
| 44 | + required: false |
| 45 | + type: string |
| 46 | + default: draft |
| 47 | + |
| 48 | +jobs: |
| 49 | + upload_build: |
| 50 | + runs-on: ubuntu-latest |
| 51 | + environment: release |
| 52 | + permissions: |
| 53 | + contents: read |
| 54 | + id-token: write |
| 55 | + steps: |
| 56 | + - name: Checkout source code |
| 57 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd |
| 58 | + with: |
| 59 | + persist-credentials: false |
| 60 | + |
| 61 | + - name: Add Toolbox Envy to PATH |
| 62 | + uses: EarthmanMuons/toolbox-envy/.github/actions/add-to-path@main |
| 63 | + with: |
| 64 | + include_bins: | |
| 65 | + common |
| 66 | + flutter |
| 67 | +
|
| 68 | + - name: Download release assets |
| 69 | + env: |
| 70 | + GH_TOKEN: ${{ github.token }} |
| 71 | + RELEASE_TAG: ${{ inputs.release_tag }} |
| 72 | + run: | |
| 73 | + set -euo pipefail |
| 74 | +
|
| 75 | + mkdir -p dist |
| 76 | + gh release download "$RELEASE_TAG" \ |
| 77 | + --pattern "*.aab" \ |
| 78 | + --pattern "sha256sums.txt" \ |
| 79 | + --dir dist |
| 80 | +
|
| 81 | + - id: verify_assets |
| 82 | + name: Verify release assets |
| 83 | + run: verify-checksums --dir dist --pattern '*.aab' |
| 84 | + |
| 85 | + - id: gcp_auth |
| 86 | + name: Configure Google Cloud authentication |
| 87 | + uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 |
| 88 | + with: |
| 89 | + workload_identity_provider: ${{ inputs.gcp_wif_provider }} |
| 90 | + service_account: ${{ inputs.gcp_service_account }} |
| 91 | + |
| 92 | + - name: upload aab |
| 93 | + uses: r0adkll/upload-google-play@935ef9c68bb393a8e6116b1575626a7f5be3a7fb |
| 94 | + with: |
| 95 | + serviceAccountJson: ${{ steps.gcp_auth.outputs.credentials_file_path }} |
| 96 | + packageName: ${{ inputs.package_name }} |
| 97 | + releaseFiles: dist/*.aab |
| 98 | + track: ${{ inputs.track }} |
| 99 | + status: ${{ inputs.release_status }} |
0 commit comments