-
-
Notifications
You must be signed in to change notification settings - Fork 251
81 lines (75 loc) · 3.25 KB
/
build-suite-native-preview.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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')
name: EAS Update
runs-on: ubuntu-latest
concurrency: fingerprint-${{ github.workflow }}-${{ github.head_ref || github.run_id }}
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
EXPO_PUBLIC_ENVIRONMENT: preview
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
COMMIT_HASH: ${{ github.sha }}
permissions:
contents: read
pull-requests: write
actions: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: yarn
- name: Setup EAS
uses: expo/expo-github-action@v8
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN_DEVELOP }}
- name: Install libs
run: yarn workspaces focus @suite-native/app
- name: Check runtimeVersion builds
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"
# 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)
if [ "$EXISTING_BUILD" = "[]" ]; then
echo "No build with runtimeVersion $RUNTIME_VERSION found"
echo "RUNTIME_BUILD_EXISTS=false" >> $GITHUB_ENV
else
echo "Found build with runtimeVersion $RUNTIME_VERSION"
echo "$EXISTING_BUILD"
echo "RUNTIME_BUILD_EXISTS=true" >> $GITHUB_ENV
fi
- name: Create 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
working-directory: suite-native/app
- name: Build message system config
run: yarn message-system-sign-config
- name: Create preview update
uses: expo/expo-github-action/preview@v8
with:
command: eas update --auto --branch ${{ env.BRANCH_NAME }}
working-directory: suite-native/app