Bumps [actions/setup-node](https://github.com/actions/setup-node) from 5 to 7. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/actions/setup-node/releases">actions/setup-node's releases</a>.</em></p> <blockquote> <h2>v7.0.0</h2> <h2>What's Changed</h2> <h3>Enhancements:</h3> <ul> <li>Add cache-primary-key and cache-matched-key as outputs by <a href="https://github.com/gowridurgad"><code>@gowridurgad</code></a> in <a href="https://redirect.github.com/actions/setup-node/pull/1577">actions/setup-node#1577</a></li> <li>Migrate to ESM and upgrade dependencies by <a href="https://github.com/gowridurgad"><code>@gowridurgad</code></a> in <a href="https://redirect.github.com/actions/setup-node/pull/1574">actions/setup-node#1574</a></li> </ul> <h3>Bug fixes:</h3> <ul> <li>Remove dummy NODE_AUTH_TOKEN export by <a href="https://github.com/gowridurgad"><code>@gowridurgad</code></a> in <a href="https://redirect.github.com/actions/setup-node/pull/1558">actions/setup-node#1558</a></li> <li>Only use <code>mirrorToken</code> in <code>getManifest</code> if it's provided by <a href="https://github.com/deiga"><code>@deiga</code></a> in <a href="https://redirect.github.com/actions/setup-node/pull/1548">actions/setup-node#1548</a></li> </ul> <h3>Documentation updates:</h3> <ul> <li>Add documentation for publishing to npm with Trusted Publisher (OIDC) by <a href="https://github.com/chiranjib-swain"><code>@chiranjib-swain</code></a> in <a href="https://redirect.github.com/actions/setup-node/pull/1536">actions/setup-node#1536</a></li> <li>docs: Update restore-only cache documentation by <a href="https://github.com/priya-kinthali"><code>@priya-kinthali</code></a> in <a href="https://redirect.github.com/actions/setup-node/pull/1550">actions/setup-node#1550</a></li> <li>docs: Update caching recommendations to mitigate cache poisoning risks by <a href="https://github.com/chiranjib-swain"><code>@chiranjib-swain</code></a> in <a href="https://redirect.github.com/actions/setup-node/pull/1567">actions/setup-node#1567</a></li> </ul> <h3>Dependency update:</h3> <ul> <li>Upgrade <code>@actions/cache</code> to 5.1.0, log cache write denied by <a href="https://github.com/jasongin"><code>@jasongin</code></a> in <a href="https://redirect.github.com/actions/setup-node/pull/1569">actions/setup-node#1569</a></li> </ul> <h2>New Contributors</h2> <ul> <li><a href="https://github.com/chiranjib-swain"><code>@chiranjib-swain</code></a> made their first contribution in <a href="https://redirect.github.com/actions/setup-node/pull/1536">actions/setup-node#1536</a></li> <li><a href="https://github.com/deiga"><code>@deiga</code></a> made their first contribution in <a href="https://redirect.github.com/actions/setup-node/pull/1548">actions/setup-node#1548</a></li> <li><a href="https://github.com/jasongin"><code>@jasongin</code></a> made their first contribution in <a href="https://redirect.github.com/actions/setup-node/pull/1569">actions/setup-node#1569</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/actions/setup-node/compare/v6...v7.0.0">https://github.com/actions/setup-node/compare/v6...v7.0.0</a></p> <h2>v6.5.0</h2> <h2>What's Changed</h2> <ul> <li>Update <code>@actions/cache</code> to 5.1.0 and add security overrides for undici and fast-xml-parser by <a href="https://github.com/HarithaVattikuti"><code>@HarithaVattikuti</code></a> in <a href="https://redirect.github.com/actions/setup-node/pull/1579">actions/setup-node#1579</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/actions/setup-node/compare/v6.4.0...v6.5.0">https://github.com/actions/setup-node/compare/v6.4.0...v6.5.0</a></p> <h2>v6.4.0</h2> <h2>What's Changed</h2> <h3>Dependency updates:</h3> <ul> <li>Upgrade <a href="https://github.com/actions"><code>@actions</code></a> dependencies by <a href="https://github.com/Copilot"><code>@Copilot</code></a> in <a href="https://redirect.github.com/actions/setup-node/pull/1525">actions/setup-node#1525</a></li> <li>Update Node.js versions in versions.yml and bump package to v6.4.0 by <a href="https://github.com/priya-kinthali"><code>@priya-kinthali</code></a> in <a href="https://redirect.github.com/actions/setup-node/pull/1533">actions/setup-node#1533</a></li> </ul> <h2>New Contributors</h2> <ul> <li><a href="https://github.com/Copilot"><code>@Copilot</code></a> made their first contribution in <a href="https://redirect.github.com/actions/setup-node/pull/1525">actions/setup-node#1525</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/actions/setup-node/compare/v6...v6.4.0">https://github.com/actions/setup-node/compare/v6...v6.4.0</a></p> <h2>v6.3.0</h2> <h2>What's Changed</h2> <h3>Enhancements:</h3> <ul> <li>Support parsing <code>devEngines</code> field by <a href="https://github.com/susnux"><code>@susnux</code></a> in <a href="https://redirect.github.com/actions/setup-node/pull/1283">actions/setup-node#1283</a></li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/actions/setup-node/commit/820762786026740c76f36085b0efc47a31fe5020"><code>8207627</code></a> Migrate to ESM and upgrade dependencies (<a href="https://redirect.github.com/actions/setup-node/issues/1574">#1574</a>)</li> <li><a href="https://github.com/actions/setup-node/commit/04be95cf3511ea51ebf9f224ddfb99cc7ab87cd4"><code>04be95c</code></a> Add cache-primary-key and cache-matched-key as outputs (<a href="https://redirect.github.com/actions/setup-node/issues/1577">#1577</a>)</li> <li><a href="https://github.com/actions/setup-node/commit/7c2c68d20d402ed6a201ada70a81341941093140"><code>7c2c68d</code></a> docs: Update caching recommendations to mitigate cache poisoning risks (<a href="https://redirect.github.com/actions/setup-node/issues/1567">#1567</a>)</li> <li><a href="https://github.com/actions/setup-node/commit/6a61c0375d66246de94630495909f12cf8dac84d"><code>6a61c03</code></a> Merge pull request <a href="https://redirect.github.com/actions/setup-node/issues/1569">#1569</a> from jasongin/update-actions-cache-5.1.0</li> <li><a href="https://github.com/actions/setup-node/commit/30eb73b41ded577900c1ebf968ef95cdf8f7434f"><code>30eb73b</code></a> Resolve high-severity audit issues</li> <li><a href="https://github.com/actions/setup-node/commit/4e1a87a501d0302f99e30e2748568adcb388d09f"><code>4e1a87a</code></a> Update dist</li> <li><a href="https://github.com/actions/setup-node/commit/360237f0c01778d0c17291f75c56d6feae4f7574"><code>360237f</code></a> Strict equality</li> <li><a href="https://github.com/actions/setup-node/commit/4f8aac5beb2f0854bc79651567a18c67eb0b9de3"><code>4f8aac5</code></a> Bump <code>@actions/cache</code> to 5.1.0, log cache write denied</li> <li><a href="https://github.com/actions/setup-node/commit/f4a67bbeca970f103397d3d2b9462cf787cd2980"><code>f4a67bb</code></a> Only use <code>mirrorToken</code> in <code>getManifest</code> if it's provided (<a href="https://redirect.github.com/actions/setup-node/issues/1548">#1548</a>)</li> <li><a href="https://github.com/actions/setup-node/commit/0355742c943ddb13ca8a6b700f824231caa91e75"><code>0355742</code></a> Remove dummy NODE_AUTH_TOKEN export (<a href="https://redirect.github.com/actions/setup-node/issues/1558">#1558</a>)</li> <li>Additional commits viewable in <a href="https://github.com/actions/setup-node/compare/v5...v7">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
265 lines
11 KiB
YAML
265 lines
11 KiB
YAML
name: Android Store Artifacts
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version_name:
|
|
description: Store version name, for example 1.4.0
|
|
required: false
|
|
type: string
|
|
version_code:
|
|
description: Store build number/version code
|
|
required: false
|
|
type: string
|
|
upload_android_to_play:
|
|
description: Upload the signed Android App Bundle to Google Play
|
|
required: false
|
|
type: boolean
|
|
default: true
|
|
android_track:
|
|
description: Google Play track for manual dispatches
|
|
required: false
|
|
type: choice
|
|
default: production
|
|
options:
|
|
- production
|
|
- beta
|
|
- alpha
|
|
- internal
|
|
android_release_status:
|
|
description: Google Play release status for manual dispatches
|
|
required: false
|
|
type: choice
|
|
default: inProgress
|
|
options:
|
|
- inProgress
|
|
- draft
|
|
- halted
|
|
push:
|
|
tags:
|
|
- "mobile-v*"
|
|
|
|
permissions:
|
|
contents: read
|
|
actions: read
|
|
|
|
concurrency:
|
|
group: android-store-artifacts-${{ github.ref_name || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
android:
|
|
name: Android AAB and Play upload
|
|
runs-on: ubuntu-24.04
|
|
environment: mobile-store-production
|
|
timeout-minutes: 60
|
|
env:
|
|
ANDROID_PACKAGE_NAME: ${{ vars.ANDROID_PACKAGE_NAME || 'io.truckwash.twa' }}
|
|
ANDROID_AAB_PATH: ${{ vars.ANDROID_AAB_PATH || 'android/app/build/outputs/bundle/release/app-release.aab' }}
|
|
ANDROID_SIGNING_IDENTITY_REF: github-environment:mobile-store-production/android-keystore
|
|
PLAY_STORE_TRACK: ${{ inputs.android_track || vars.PLAY_STORE_TRACK || 'production' }}
|
|
PLAY_STORE_RELEASE_STATUS: ${{ inputs.android_release_status || 'inProgress' }}
|
|
PLAY_STORE_USER_FRACTION: "0.01"
|
|
UPLOAD_ANDROID_TO_PLAY: ${{ github.event_name != 'workflow_dispatch' || inputs.upload_android_to_play }}
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
ref: ${{ github.sha }}
|
|
persist-credentials: false
|
|
|
|
- name: Guard current master release
|
|
id: release-guard
|
|
shell: bash
|
|
env:
|
|
EVENT_NAME: ${{ github.event_name }}
|
|
EXPECTED_SHA: ${{ github.sha }}
|
|
RELEASE_BRANCH: ${{ github.ref_name }}
|
|
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
|
UPLOAD_TO_PLAY: ${{ github.event_name != 'workflow_dispatch' || inputs.upload_android_to_play }}
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
set -euo pipefail
|
|
current=true
|
|
latest_sha="$(curl --fail --silent --show-error --location \
|
|
-H "Authorization: Bearer $GH_TOKEN" \
|
|
-H "Accept: application/vnd.github+json" \
|
|
"$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/git/ref/heads/$DEFAULT_BRANCH" | jq -r '.object.sha // empty')"
|
|
if [[ ! "$latest_sha" =~ ^[0-9a-f]{40}$ ]]; then
|
|
echo "Could not resolve origin/$DEFAULT_BRANCH." >&2
|
|
exit 1
|
|
fi
|
|
if [[ "$latest_sha" != "$EXPECTED_SHA" && "$UPLOAD_TO_PLAY" == "true" ]]; then
|
|
current=false
|
|
echo "Skipping stale mobile upload for $EXPECTED_SHA; origin/$DEFAULT_BRANCH is $latest_sha."
|
|
elif [[ "$latest_sha" != "$EXPECTED_SHA" ]]; then
|
|
echo "Allowing artifact-only build for $EVENT_NAME on $RELEASE_BRANCH; store upload remains disabled."
|
|
else
|
|
echo "Mobile upload commit is current for $DEFAULT_BRANCH."
|
|
fi
|
|
echo "current=$current" >> "$GITHUB_OUTPUT"
|
|
echo "source_sha=$latest_sha" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Setup Node.js
|
|
if: steps.release-guard.outputs.current == 'true'
|
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
with:
|
|
node-version: 22
|
|
cache: npm
|
|
|
|
- name: Require green Chromium mobile tests before Play upload
|
|
if: steps.release-guard.outputs.current == 'true' && env.UPLOAD_ANDROID_TO_PLAY == 'true'
|
|
run: node scripts/mobile/verify-store-test-gate.mjs --platform android
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
STORE_SOURCE_SHA: ${{ steps.release-guard.outputs.source_sha }}
|
|
TEST_WORKFLOW_RUN_ID: ""
|
|
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
|
|
|
- name: Setup Java
|
|
if: steps.release-guard.outputs.current == 'true'
|
|
uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5.6.0
|
|
with:
|
|
distribution: temurin
|
|
java-version: 21
|
|
|
|
- name: Setup Android SDK
|
|
if: steps.release-guard.outputs.current == 'true'
|
|
uses: android-actions/setup-android@40fd30fb8d7440372e1316f5d1809ec01dcd3699 # v4.0.1
|
|
|
|
- name: Install Android SDK packages
|
|
if: steps.release-guard.outputs.current == 'true'
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
yes | sdkmanager --licenses >/dev/null || true
|
|
sdkmanager "platforms;android-36" "build-tools;36.0.0"
|
|
|
|
- name: Resolve mobile version
|
|
if: steps.release-guard.outputs.current == 'true'
|
|
shell: bash
|
|
env:
|
|
INPUT_VERSION_NAME: ${{ inputs.version_name || '' }}
|
|
INPUT_VERSION_CODE: ${{ inputs.version_code || '' }}
|
|
run: |
|
|
set -euo pipefail
|
|
version_name="$INPUT_VERSION_NAME"
|
|
if [[ -z "$version_name" && "$GITHUB_REF_NAME" == mobile-v* ]]; then
|
|
version_name="${GITHUB_REF_NAME#mobile-v}"
|
|
fi
|
|
if [[ -z "$version_name" ]]; then
|
|
version_name="0.0.${GITHUB_RUN_NUMBER}"
|
|
fi
|
|
version_code="${INPUT_VERSION_CODE:-$GITHUB_RUN_NUMBER}"
|
|
echo "MOBILE_VERSION_NAME=$version_name" >> "$GITHUB_ENV"
|
|
echo "MOBILE_VERSION_CODE=$version_code" >> "$GITHUB_ENV"
|
|
|
|
- name: Check Android store environment
|
|
if: steps.release-guard.outputs.current == 'true'
|
|
env:
|
|
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
|
|
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
|
|
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
|
|
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
|
|
GOOGLE_PLAY_SERVICE_ACCOUNT_JSON_BASE64: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON_BASE64 }}
|
|
run: node scripts/mobile/check-store-upload-env.mjs --android
|
|
|
|
- name: Install dependencies
|
|
if: steps.release-guard.outputs.current == 'true'
|
|
run: npm ci --legacy-peer-deps
|
|
|
|
- name: Decode Android signing key
|
|
if: steps.release-guard.outputs.current == 'true'
|
|
shell: bash
|
|
env:
|
|
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
|
|
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
|
|
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
|
|
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
|
|
run: |
|
|
set -euo pipefail
|
|
keystore_path="$RUNNER_TEMP/android-release.keystore"
|
|
node -e "const fs = require('fs'); fs.writeFileSync(process.argv[1], Buffer.from(process.env.ANDROID_KEYSTORE_BASE64, 'base64'))" "$keystore_path"
|
|
echo "ANDROID_KEYSTORE_FILE=$keystore_path" >> "$GITHUB_ENV"
|
|
echo "ANDROID_KEYSTORE_PASSWORD=$ANDROID_KEYSTORE_PASSWORD" >> "$GITHUB_ENV"
|
|
echo "ANDROID_KEY_ALIAS=$ANDROID_KEY_ALIAS" >> "$GITHUB_ENV"
|
|
echo "ANDROID_KEY_PASSWORD=$ANDROID_KEY_PASSWORD" >> "$GITHUB_ENV"
|
|
|
|
- name: Build and sync Android shell
|
|
if: steps.release-guard.outputs.current == 'true'
|
|
run: |
|
|
npm run mobile:android:sync
|
|
npm run mobile:permissions:check
|
|
npm run mobile:android:signing:check
|
|
|
|
- name: Build signed Android App Bundle
|
|
if: steps.release-guard.outputs.current == 'true'
|
|
working-directory: android
|
|
run: ./gradlew --no-daemon bundleRelease
|
|
|
|
- name: Verify Android App Bundle signature
|
|
if: steps.release-guard.outputs.current == 'true'
|
|
run: jarsigner -verify -certs -verbose "$ANDROID_AAB_PATH" >/dev/null
|
|
|
|
- name: Record immutable Android artifact proof
|
|
if: steps.release-guard.outputs.current == 'true'
|
|
id: artifact-proof
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
artifact_sha256="$(sha256sum "$ANDROID_AAB_PATH" | awk '{print $1}')"
|
|
[[ "$artifact_sha256" =~ ^[0-9a-f]{64}$ ]]
|
|
echo "ANDROID_AAB_SHA256=$artifact_sha256" >> "$GITHUB_ENV"
|
|
echo "sha256=$artifact_sha256" >> "$GITHUB_OUTPUT"
|
|
echo "Android AAB SHA-256: \`$artifact_sha256\`" >> "$GITHUB_STEP_SUMMARY"
|
|
|
|
- name: Upload Android artifact
|
|
if: steps.release-guard.outputs.current == 'true'
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: truck-wash-android-${{ env.MOBILE_VERSION_NAME }}-${{ github.sha }}
|
|
path: ${{ env.ANDROID_AAB_PATH }}
|
|
if-no-files-found: error
|
|
retention-days: 14
|
|
|
|
- name: Recheck live master before Play upload
|
|
if: steps.release-guard.outputs.current == 'true' && env.UPLOAD_ANDROID_TO_PLAY == 'true'
|
|
env:
|
|
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
|
EXPECTED_SHA: ${{ steps.release-guard.outputs.source_sha }}
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
set -euo pipefail
|
|
live_master_sha="$(curl --fail --silent --show-error --location \
|
|
-H "Authorization: Bearer $GH_TOKEN" \
|
|
-H "Accept: application/vnd.github+json" \
|
|
"$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/git/ref/heads/$DEFAULT_BRANCH" | jq -r '.object.sha // empty')"
|
|
[[ "$live_master_sha" =~ ^[0-9a-f]{40}$ ]] || { echo "Could not resolve origin/$DEFAULT_BRANCH." >&2; exit 1; }
|
|
[[ "$live_master_sha" == "$EXPECTED_SHA" ]] || {
|
|
echo "$DEFAULT_BRANCH advanced while the Android bundle was building; refusing Play upload." >&2
|
|
exit 1
|
|
}
|
|
|
|
- name: Upload Android App Bundle to Google Play
|
|
if: steps.release-guard.outputs.current == 'true' && env.UPLOAD_ANDROID_TO_PLAY == 'true'
|
|
id: play-upload
|
|
env:
|
|
GOOGLE_PLAY_SERVICE_ACCOUNT_JSON_BASE64: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON_BASE64 }}
|
|
run: npm run mobile:android:play-upload
|
|
|
|
- name: Record Google Play submission proof
|
|
if: steps.release-guard.outputs.current == 'true' && env.UPLOAD_ANDROID_TO_PLAY == 'true'
|
|
env:
|
|
ARTIFACT_SHA256: ${{ steps.artifact-proof.outputs.sha256 }}
|
|
PLAY_EDIT_ID: ${{ steps.play-upload.outputs.play_edit_id }}
|
|
PLAY_VERSION_CODE: ${{ steps.play-upload.outputs.version_code }}
|
|
run: |
|
|
set -euo pipefail
|
|
test -n "$ARTIFACT_SHA256"
|
|
test -n "$PLAY_EDIT_ID"
|
|
test -n "$PLAY_VERSION_CODE"
|
|
printf 'Google Play submission proof: platform=android applicationId=%s version=%s buildNumber=%s artifactSha256=%s signingIdentityRef=%s storeSubmissionId=%s status=%s fraction=%s\n' \
|
|
"$ANDROID_PACKAGE_NAME" "$MOBILE_VERSION_NAME" "$PLAY_VERSION_CODE" \
|
|
"$ARTIFACT_SHA256" "$ANDROID_SIGNING_IDENTITY_REF" "$PLAY_EDIT_ID" \
|
|
"$PLAY_STORE_RELEASE_STATUS" "$PLAY_STORE_USER_FRACTION" >> "$GITHUB_STEP_SUMMARY"
|