Force native builds when package.json version changes in OTA deploy (#11061)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -31,7 +31,9 @@ jobs:
|
|||||||
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}-deploy
|
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}-deploy
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
outputs:
|
outputs:
|
||||||
changes-detected: ${{ steps.fingerprint.outputs.includes-changes }}
|
# A version bump forces a native build even if the fingerprint is unchanged
|
||||||
|
changes-detected: ${{ steps.fingerprint.outputs.includes-changes ||
|
||||||
|
steps.version.outputs.version-changed }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check for EXPO_TOKEN
|
- name: Check for EXPO_TOKEN
|
||||||
@@ -60,6 +62,27 @@ jobs:
|
|||||||
if: ${{ github.ref != 'refs/heads/main' }}
|
if: ${{ github.ref != 'refs/heads/main' }}
|
||||||
run: git fetch origin main:main --depth 100
|
run: git fetch origin main:main --depth 100
|
||||||
|
|
||||||
|
# A change to the version in package.json means a new native release, so
|
||||||
|
# an OTA update must not be deployed and full native builds are required
|
||||||
|
# regardless of what the fingerprint says
|
||||||
|
- name: 🔢 Check for version change
|
||||||
|
id: version
|
||||||
|
if: ${{ github.event_name == 'push' }}
|
||||||
|
env:
|
||||||
|
EVENT_BEFORE: ${{ github.event.before }}
|
||||||
|
run: |
|
||||||
|
CURRENT_VERSION=$(jq -r '.version' package.json)
|
||||||
|
if [ -n "$EVENT_BEFORE" ] && [[ ! "$EVENT_BEFORE" =~ ^0+$ ]] && git cat-file -e "$EVENT_BEFORE:package.json" 2>/dev/null; then
|
||||||
|
PREVIOUS_VERSION=$(git show "$EVENT_BEFORE:package.json" | jq -r '.version')
|
||||||
|
else
|
||||||
|
PREVIOUS_VERSION=$(git show HEAD~1:package.json | jq -r '.version')
|
||||||
|
fi
|
||||||
|
echo "Previous version: $PREVIOUS_VERSION, current version: $CURRENT_VERSION"
|
||||||
|
if [ "$CURRENT_VERSION" != "$PREVIOUS_VERSION" ]; then
|
||||||
|
echo "Version changed, full native builds are required"
|
||||||
|
echo "version-changed=true" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
|
||||||
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
|
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
|
||||||
|
|
||||||
- name: 🔧 Setup Node
|
- name: 🔧 Setup Node
|
||||||
@@ -93,14 +116,16 @@ jobs:
|
|||||||
|
|
||||||
- name: 🔨 Setup EAS
|
- name: 🔨 Setup EAS
|
||||||
uses: expo/expo-github-action@eab7a230208c952974db8c3245cfd78402c7b385 # 9.0.0
|
uses: expo/expo-github-action@eab7a230208c952974db8c3245cfd78402c7b385 # 9.0.0
|
||||||
if: ${{ !steps.fingerprint.outputs.includes-changes }}
|
if: ${{ !steps.fingerprint.outputs.includes-changes &&
|
||||||
|
!steps.version.outputs.version-changed }}
|
||||||
with:
|
with:
|
||||||
eas-version: '19.0.5'
|
eas-version: '19.0.5'
|
||||||
packager: 'pnpm --allow-build=dtrace-provider'
|
packager: 'pnpm --allow-build=dtrace-provider'
|
||||||
token: ${{ secrets.EXPO_TOKEN }}
|
token: ${{ secrets.EXPO_TOKEN }}
|
||||||
|
|
||||||
- name: 🪛 Setup jq
|
- name: 🪛 Setup jq
|
||||||
if: ${{ !steps.fingerprint.outputs.includes-changes }}
|
if: ${{ !steps.fingerprint.outputs.includes-changes &&
|
||||||
|
!steps.version.outputs.version-changed }}
|
||||||
uses: dcarbone/install-jq-action@4fcb5062d7ce9bc4382d1a352d19ba3ba2c317c1 # v4.0.1
|
uses: dcarbone/install-jq-action@4fcb5062d7ce9bc4382d1a352d19ba3ba2c317c1 # v4.0.1
|
||||||
|
|
||||||
# eas.json not used here, set EXPO_PUBLIC_ENV
|
# eas.json not used here, set EXPO_PUBLIC_ENV
|
||||||
@@ -109,7 +134,8 @@ jobs:
|
|||||||
CHANNEL: ${{ inputs.channel || 'testflight' }}
|
CHANNEL: ${{ inputs.channel || 'testflight' }}
|
||||||
GITHUB_SHA: ${{ github.sha }}
|
GITHUB_SHA: ${{ github.sha }}
|
||||||
id: env
|
id: env
|
||||||
if: ${{ !steps.fingerprint.outputs.includes-changes }}
|
if: ${{ !steps.fingerprint.outputs.includes-changes &&
|
||||||
|
!steps.version.outputs.version-changed }}
|
||||||
run: |
|
run: |
|
||||||
export json='${{ secrets.GOOGLE_SERVICES_TOKEN }}'
|
export json='${{ secrets.GOOGLE_SERVICES_TOKEN }}'
|
||||||
echo "${{ secrets.ENV_TOKEN }}" > .env
|
echo "${{ secrets.ENV_TOKEN }}" > .env
|
||||||
@@ -125,7 +151,8 @@ jobs:
|
|||||||
echo "$json" > google-services.json
|
echo "$json" > google-services.json
|
||||||
|
|
||||||
- name: 🏗️ Create Bundle
|
- name: 🏗️ Create Bundle
|
||||||
if: ${{ !steps.fingerprint.outputs.includes-changes }}
|
if: ${{ !steps.fingerprint.outputs.includes-changes &&
|
||||||
|
!steps.version.outputs.version-changed }}
|
||||||
run: >
|
run: >
|
||||||
SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}
|
SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||||
SENTRY_RELEASE=${{ steps.env.outputs.EXPO_PUBLIC_RELEASE_VERSION }}
|
SENTRY_RELEASE=${{ steps.env.outputs.EXPO_PUBLIC_RELEASE_VERSION }}
|
||||||
@@ -133,7 +160,8 @@ jobs:
|
|||||||
pnpm export
|
pnpm export
|
||||||
|
|
||||||
- name: 📦 Package Bundle and 🚀 Deploy
|
- name: 📦 Package Bundle and 🚀 Deploy
|
||||||
if: ${{ !steps.fingerprint.outputs.includes-changes }}
|
if: ${{ !steps.fingerprint.outputs.includes-changes &&
|
||||||
|
!steps.version.outputs.version-changed }}
|
||||||
run: pnpm use-build-number bash scripts/bundleUpdate.sh
|
run: pnpm use-build-number bash scripts/bundleUpdate.sh
|
||||||
env:
|
env:
|
||||||
DENIS_API_KEY: ${{ secrets.DENIS_API_KEY }}
|
DENIS_API_KEY: ${{ secrets.DENIS_API_KEY }}
|
||||||
@@ -143,13 +171,15 @@ jobs:
|
|||||||
- name: ⬇️ Restore Cache
|
- name: ⬇️ Restore Cache
|
||||||
id: get-base-commit
|
id: get-base-commit
|
||||||
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||||
if: ${{ !steps.fingerprint.outputs.includes-changes }}
|
if: ${{ !steps.fingerprint.outputs.includes-changes &&
|
||||||
|
!steps.version.outputs.version-changed }}
|
||||||
with:
|
with:
|
||||||
path: most-recent-testflight-commit.txt
|
path: most-recent-testflight-commit.txt
|
||||||
key: most-recent-testflight-commit
|
key: most-recent-testflight-commit
|
||||||
|
|
||||||
- name: ✏️ Write commit hash to cache
|
- name: ✏️ Write commit hash to cache
|
||||||
if: ${{ !steps.fingerprint.outputs.includes-changes }}
|
if: ${{ !steps.fingerprint.outputs.includes-changes &&
|
||||||
|
!steps.version.outputs.version-changed }}
|
||||||
run: echo $GITHUB_SHA > most-recent-testflight-commit.txt
|
run: echo $GITHUB_SHA > most-recent-testflight-commit.txt
|
||||||
|
|
||||||
# GitHub actions are horrible so let's just copy paste this in
|
# GitHub actions are horrible so let's just copy paste this in
|
||||||
|
|||||||
Reference in New Issue
Block a user