Skip to content

Commit

Permalink
chore(ci): wip
Browse files Browse the repository at this point in the history
  • Loading branch information
matejkriz committed Dec 13, 2024
1 parent a784199 commit c1ae492
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 24 deletions.
39 changes: 17 additions & 22 deletions .github/workflows/build-suite-native-preview.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
name: "[Build] suite-native preview"

on:
push:
# push develop(default) branch is necessary for this action to update its fingerprint database
branches: [develop]
pull_request:
types: [opened, synchronize, labeled]
paths:
- "suite-native/**"
- "suite-common/**"
- "packages/react-native-usb/**"
- "packages/transport-native/**"
- "yarn.lock"
- ".github/workflows/build-suite-native-preview.yml"
# list of paths is not complete, but it's always possible to dispatch manually using 'build-mobile' label
workflow_dispatch:
# manual dispatch will not add any comment to PR, use label 'build-mobile' if PR exists

jobs:
update:
if: ( github.event.action != 'labeled' || contains(github.event.pull_request.labels.*.name, 'build-mobile')) && (github.repository == 'trezor/trezor-suite' || github.repository == 'trezor/trezor-suite-private')
if: (contains(toJson(github.event.pull_request.changed_files), 'suite-native/') || contains(github.event.pull_request.labels.*.name, 'build-mobile')) && (github.repository == 'trezor/trezor-suite' || github.repository == 'trezor/trezor-suite-private')
name: EAS Update
runs-on: ubuntu-latest
concurrency: fingerprint-${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand Down Expand Up @@ -50,25 +37,33 @@ jobs:
run: |
cd suite-native/app
# Read runtimeVersion from dynamic app.json
RUNTIME_VERSION=$(npx expo config --json | jq -r '.runtimeVersion')
echo "Current runtimeVersion is $RUNTIME_VERSION"
FINGERPRINT_HASH=$(npx @expo/fingerprint | jq -r '.hash')
echo "Current fingerprint hash is $FINGERPRINT_HASH"
# Check if there is a build with the same runtimeVersion on EAS already
EXISTING_BUILD=$(eas build:list --status=finished --build-profile=preview --channel=preview --limit=1 --non-interactive --json --runtime-version=$RUNTIME_VERSION)
EXISTING_BUILD=$(eas build:list --status=finished --build-profile=preview --channel=preview --limit=1 --non-interactive --json --runtime-version=$FINGERPRINT_HASH)
if [ "$EXISTING_BUILD" = "[]" ]; then
echo "No build with runtimeVersion $RUNTIME_VERSION found"
echo "No build with runtimeVersion $FINGERPRINT_HASH found"
echo "RUNTIME_BUILD_EXISTS=false" >> $GITHUB_ENV
else
echo "Found build with runtimeVersion $RUNTIME_VERSION"
echo "Found build with runtimeVersion $FINGERPRINT_HASH"
echo "$EXISTING_BUILD"
echo "RUNTIME_BUILD_EXISTS=true" >> $GITHUB_ENV
fi
- name: Create preview builds if fingerprint changed
- name: Create ANDROID preview builds if fingerprint changed
# Only create preview builds if there is no build with the same runtimeVersion on EAS already
if: env.RUNTIME_BUILD_EXISTS == 'false'
uses: expo/expo-github-action/preview-build@main
with:
command: eas build --profile preview --platform all
command: eas build --profile preview --platform android --no-wait
working-directory: suite-native/app

- name: Create iOS preview builds if fingerprint changed
# Only create preview builds if there is no build with the same runtimeVersion on EAS already
if: env.RUNTIME_BUILD_EXISTS == 'false'
uses: expo/expo-github-action/preview-build@main
with:
command: eas build --profile preview --platform ios --auto-submit --no-wait
working-directory: suite-native/app

- name: Build message system config
Expand All @@ -77,5 +72,5 @@ jobs:
- name: Create preview update
uses: expo/expo-github-action/preview@v8
with:
command: eas update --auto --branch ${{ env.BRANCH_NAME }}
command: eas update --auto --branch ${{ env.BRANCH_NAME }} --non-interactive
working-directory: suite-native/app
4 changes: 3 additions & 1 deletion suite-native/app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ export default ({ config }: ConfigContext): ExpoConfig => {
slug: appSlugs[buildType],
owner: appOwners[buildType],
version: suiteNativeVersion,
runtimeVersion: '20',
runtimeVersion: {
policy: 'fingerprint',
},
...(buildType === 'production'
? {}
: {
Expand Down
15 changes: 14 additions & 1 deletion suite-native/app/eas.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@
"autoIncrement": true,
"developmentClient": true,
"credentialsSource": "remote",
"distribution": "internal"
"ios": {
"distribution": "store"
},
"android": {
"distribution": "internal",
"resourceClass": "large"
}
},
"adhoc": {
"extends": "preview",
Expand Down Expand Up @@ -68,6 +74,13 @@
"appleTeamId": "C3P22XVH2C"
}
},
"preview": {
"ios": {
"bundleIdentifier": "io.trezor.suite.preview",
"ascAppId": "6739429089",
"appleTeamId": "C3P22XVH2C"
}
},
"production": {
"android": {
"track": "internal",
Expand Down

0 comments on commit c1ae492

Please sign in to comment.