Skip to content

Commit

Permalink
chore(suite-native): add github workflow for preview builds and updates
Browse files Browse the repository at this point in the history
  • Loading branch information
matejkriz committed Oct 22, 2024
1 parent 3702e71 commit 04b441b
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 14 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/build-suite-native-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
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:
paths:
- "suite-native/**"
- "packages/react-native-usb/**"
- "packages/transport-native/**"
- "yarn.lock"
# list of paths is not complete, but it's always possible to dispatch manually
workflow_dispatch:

jobs:
update:
if: 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 }}
NODE_ENV: preview
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: Create preview builds if fingerprint changed
uses: expo/expo-github-action/preview-build@main
with:
command: eas build --profile preview --platform all
working-directory: suite-native/app

- name: Install deps and build libs
run: |
yarn install --immutable
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
1 change: 0 additions & 1 deletion suite-native/app/.env.preview
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
EXPO_PUBLIC_ENVIRONMENT=preview
EXPO_PUBLIC_CODESIGN_BUILD=false
EXPO_PUBLIC_BLUETOOTH_ENABLED=true
3 changes: 3 additions & 0 deletions suite-native/app/.fingerprintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ios/**/*

!ios/Podfile.lock
4 changes: 4 additions & 0 deletions suite-native/app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ You can override ENV variables locally using `.env.development.local` (or `.env.

> You can use `EXPO_PUBLIC_IS_ANALYTICS_LOGGER_ENABLED=true` in `.env.development.local` to debug analytics locally.
## Native changes - bumping runtimeVersion

Whenever you do a change in a native code (updating native dependency and so on), you have to bump `runtimeVersion` in `app.config.ts` file manually so EAS knows that it has to prepare new development build. See [Runtime Versions Expo Docs](https://docs.expo.dev/distribution/runtime-versions/). Hopefully it's just a temporary situation until [fingerprint policy](https://docs.expo.dev/eas-update/runtime-versions/#fingerprint-runtime-version-policy) is finalized. Fingerprint policy is not working well with development builds yet, waiting for SDK 52.

## Troubleshooting

1. For any issues with the build, try to clean the project and rebuild it:
Expand Down
7 changes: 2 additions & 5 deletions suite-native/app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ const getPlugins = (): ExpoPlugins => {
'@sentry/react-native/expo',
{
url: 'https://sentry.io/',
authToken: process.env.SENTRY_AUTH_TOKEN,
project: 'suite-native',
organization: 'satoshilabs',
},
Expand All @@ -170,10 +169,8 @@ export default ({ config }: ConfigContext): ExpoConfig => {
slug: appSlugs[buildType],
owner: appOwners[buildType],
version: suiteNativeVersion,
runtimeVersion: {
policy: 'fingerprint',
},
...(buildType === 'develop'
runtimeVersion: '7',
...(['develop', 'preview'].includes(buildType)
? {
updates: {
url: `https://u.expo.dev/${projectId}`,
Expand Down
12 changes: 4 additions & 8 deletions suite-native/app/eas.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,16 @@
"EXPO_PUBLIC_ENVIRONMENT": "preview",
"EXPO_PUBLIC_CODESIGN_BUILD": "false"
},
"channel": "preview",
"autoIncrement": true,
"developmentClient": true,
"credentialsSource": "remote",
"distribution": "internal"
},
"adhoc": {
"env": {
"EXPO_PUBLIC_ENVIRONMENT": "preview",
"EXPO_PUBLIC_BLUETOOTH_ENABLED": "true",
"EXPO_PUBLIC_CODESIGN_BUILD": "false"
},
"autoIncrement": true,
"credentialsSource": "remote",
"distribution": "internal"
"extends": "preview",
"developmentClient": false,
"channel": "adhoc"
},
"production": {
"env": {
Expand Down

0 comments on commit 04b441b

Please sign in to comment.