Skip to content

Commit debafe1

Browse files
committed
ci: build and upload example app
1 parent 84529e0 commit debafe1

1 file changed

Lines changed: 142 additions & 0 deletions

File tree

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
name: Build example apps
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- docs/**
9+
- '**/*.md'
10+
pull_request:
11+
paths-ignore:
12+
- docs/**
13+
- '**/*.md'
14+
workflow_dispatch:
15+
16+
permissions:
17+
contents: read
18+
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.ref }}
21+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
22+
23+
jobs:
24+
android:
25+
name: Android
26+
runs-on: ubuntu-latest
27+
timeout-minutes: 60
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
31+
32+
- name: Setup
33+
uses: ./.github/actions/setup
34+
35+
- name: Calculate fingerprint
36+
id: fingerprint
37+
working-directory: example
38+
run: |
39+
fingerprint=$(yarn expo-updates fingerprint:generate --platform android | jq -er .hash)
40+
echo "fingerprint=$fingerprint" >> "$GITHUB_OUTPUT"
41+
42+
- name: Cache release build
43+
id: cache
44+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
45+
with:
46+
path: react-native-paper-example.apk
47+
key: android-${{ steps.fingerprint.outputs.fingerprint }}
48+
49+
# Repacking shells out to `apktool`, so this cannot be gated on the cache.
50+
- name: Setup JDK
51+
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
52+
with:
53+
distribution: temurin
54+
java-version: 17
55+
56+
- name: Build Android app
57+
if: steps.cache.outputs.cache-hit != 'true'
58+
working-directory: example
59+
run: |
60+
yarn expo prebuild --platform android --no-install
61+
cd android
62+
./gradlew :app:assembleRelease
63+
mv app/build/outputs/apk/release/app-release.apk ../../react-native-paper-example.apk
64+
65+
- name: Repack cached build
66+
if: steps.cache.outputs.cache-hit == 'true'
67+
working-directory: example
68+
run: |
69+
yarn dlx @expo/repack-app@0.10.3 \
70+
--platform android \
71+
--source-app ../react-native-paper-example.apk \
72+
--output ../react-native-paper-example.apk
73+
74+
- name: Upload APK
75+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
76+
with:
77+
path: react-native-paper-example.apk
78+
archive: false
79+
retention-days: 30
80+
81+
ios:
82+
name: iOS
83+
runs-on: macos-latest
84+
timeout-minutes: 60
85+
steps:
86+
- name: Checkout
87+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
88+
89+
- name: Setup
90+
uses: ./.github/actions/setup
91+
92+
- name: Calculate fingerprint
93+
id: fingerprint
94+
working-directory: example
95+
run: |
96+
fingerprint=$(yarn expo-updates fingerprint:generate --platform ios | jq -er .hash)
97+
echo "fingerprint=$fingerprint" >> "$GITHUB_OUTPUT"
98+
99+
- name: Cache release build
100+
id: cache
101+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
102+
with:
103+
path: react-native-paper-example.app
104+
key: ios-${{ steps.fingerprint.outputs.fingerprint }}
105+
106+
- name: Build iOS app
107+
if: steps.cache.outputs.cache-hit != 'true'
108+
working-directory: example
109+
run: |
110+
yarn expo prebuild --platform ios --no-install
111+
cd ios
112+
pod install
113+
xcodebuild build \
114+
-workspace ReactNativePaperExample.xcworkspace \
115+
-scheme ReactNativePaperExample \
116+
-configuration Release \
117+
-destination 'generic/platform=iOS Simulator' \
118+
-derivedDataPath build \
119+
ARCHS=arm64
120+
mv build/Build/Products/Release-iphonesimulator/ReactNativePaperExample.app ../../react-native-paper-example.app
121+
122+
# Repacking in place fails with ENOTEMPTY on an existing app directory.
123+
- name: Repack cached build
124+
if: steps.cache.outputs.cache-hit == 'true'
125+
working-directory: example
126+
run: |
127+
mv ../react-native-paper-example.app "$RUNNER_TEMP/cached.app"
128+
yarn dlx @expo/repack-app@0.10.3 \
129+
--platform ios \
130+
--source-app "$RUNNER_TEMP/cached.app" \
131+
--output ../react-native-paper-example.app
132+
133+
# `ditto` keeps the symlinks and executable bits a plain upload drops.
134+
- name: Archive app
135+
run: ditto -c -k --keepParent react-native-paper-example.app react-native-paper-example.app.zip
136+
137+
- name: Upload app
138+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
139+
with:
140+
path: react-native-paper-example.app.zip
141+
archive: false
142+
retention-days: 30

0 commit comments

Comments
 (0)