Skip to content

Commit

Permalink
ci: migrate classic updates to EAS (#11010)
Browse files Browse the repository at this point in the history
As the classic build service will not be supported anymore in SDK >=47
Expo docs advise migrating from classic updates (expo publish) to
next-gen EAS Update.

https://docs.expo.dev/eas-update/migrate-to-eas-update/
https://blog.expo.dev/turtle-goes-out-to-sea-d334db2a6b60
  • Loading branch information
kacperkapusciak authored and satya164 committed Nov 27, 2022
1 parent d418246 commit f971b7c
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 9 deletions.
25 changes: 20 additions & 5 deletions .github/workflows/expo-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,41 @@ jobs:
uses: ./.github/actions/setup

- name: Setup Expo
uses: expo/expo-github-action@v6
uses: expo/expo-github-action@v7
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}

- name: Publish Expo app
working-directory: ./example
run: yarn expo-cli publish --release-channel=pr-${{ github.event.number }}
run: CI=1 eas update --branch=pr-${{ github.event.number }} --message="$(git log -1 --pretty=%B)"
env:
EXPO_USE_DEV_SERVER: true

- name: Get expo link
- name: Get expo config
working-directory: ./example
id: expo
run: echo "::set-output name=path::@react-navigation/react-navigation-example?release-channel=pr-${{ github.event.number }}"
run: echo "EXPO_CONFIG=$(npx expo config --json)" >> $GITHUB_OUTPUT

- name: Comment on PR
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const body = 'The Expo app for the example from this branch is ready!\n\n[expo.dev/${{ steps.expo.outputs.path }}](https://expo.dev/${{ steps.expo.outputs.path }})\n\n<a href="https://exp.host/${{ steps.expo.outputs.path }}"><img src="https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=exp://exp.host/${{ steps.expo.outputs.path }}" height="200px" width="200px"></a>';
const config = JSON.parse('${{ steps.expo.outputs.EXPO_CONFIG }}');
const { sdkVersion } = config;
const { projectId } = config.extra.eas;
const channel = 'pr-${{ github.event.number }}';
const url = `https://expo.dev/@react-navigation/react-navigation-example?serviceType=eas&distribution=expo-go&scheme=exp+react-navigation-example&channel=${channel}&sdkVersion=${sdkVersion}`;
const body = `The Expo app for the example from this branch is ready!
[${url}](${url})
<a href="${url}"><img src="https://qr.expo.dev/eas-update?appScheme=exp&projectId=${projectId}&channel=${channel}&runtimeVersion=exposdk:${sdkVersion}&host=u.expo.dev" height="200px" width="200px"></a>
`;
const comments = await github.issues.listComments({
issue_number: context.issue.number,
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/expo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ jobs:
uses: ./.github/actions/setup

- name: Setup Expo
uses: expo/expo-github-action@v6
uses: expo/expo-github-action@v7
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}

- name: Publish Expo app
working-directory: ./example
run: yarn expo-cli publish
run: CI=1 eas update --auto
11 changes: 10 additions & 1 deletion example/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"bundleIdentifier": "org.reactnavigation.example"
},
"updates": {
"fallbackToCacheTimeout": 0
"fallbackToCacheTimeout": 0,
"url": "https://u.expo.dev/a7070fc4-41f3-403d-826d-292b5d868327"
},
"assetBundlePatterns": [
"**/*"
Expand All @@ -33,6 +34,14 @@
"entryPoint": "App.tsx",
"android": {
"package": "org.reactnavigation.example"
},
"extra": {
"eas": {
"projectId": "a7070fc4-41f3-403d-826d-292b5d868327"
}
},
"runtimeVersion": {
"policy": "sdkVersion"
}
}
}
2 changes: 1 addition & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "5.1.0",
"private": true,
"scripts": {
"start": "expo start --dev-client",
"start": "NODE_OPTIONS=--openssl-legacy-provider expo start",
"client": "NODE_OPTIONS=--openssl-legacy-provider expo start --dev-client",
"web": "NODE_OPTIONS=--openssl-legacy-provider expo start --web",
"web:export": "NODE_OPTIONS=--openssl-legacy-provider expo export:web",
Expand Down

0 comments on commit f971b7c

Please sign in to comment.