Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 143 additions & 0 deletions .github/workflows/build-example-apps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
name: Build example apps

on:
push:
branches:
- main
paths-ignore:
- docs/**
- '**/*.md'
pull_request:
paths-ignore:
- docs/**
- '**/*.md'
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
android:
name: Android
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Setup
uses: ./.github/actions/setup

- name: Calculate fingerprint
id: fingerprint
working-directory: example
run: |
fingerprint=$(yarn expo-updates fingerprint:generate --platform android | jq -er .hash)
echo "fingerprint=$fingerprint" >> "$GITHUB_OUTPUT"

- name: Cache release build
id: cache
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: react-native-paper-example.apk
key: android-${{ steps.fingerprint.outputs.fingerprint }}

# Repacking shells out to `apktool`, so this cannot be gated on the cache.
- name: Setup JDK
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
with:
distribution: temurin
java-version: 17

# KSP in `expo-updates` runs out of the 512m metaspace that `expo prebuild` sets.
- name: Build Android app
if: steps.cache.outputs.cache-hit != 'true'
working-directory: example
run: |
yarn expo prebuild --platform android --no-install
cd android
./gradlew :app:assembleRelease -Dorg.gradle.jvmargs=-XX:MaxMetaspaceSize=1g -PreactNativeArchitectures=arm64-v8a,x86_64
mv app/build/outputs/apk/release/app-release.apk ../../react-native-paper-example.apk

- name: Repack cached build
if: steps.cache.outputs.cache-hit == 'true'
working-directory: example
run: |
yarn dlx @expo/repack-app@0.10.3 \
--platform android \
--source-app ../react-native-paper-example.apk \
--output ../react-native-paper-example.apk

- name: Upload APK
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
path: react-native-paper-example.apk
archive: false
retention-days: 30

ios:
name: iOS
runs-on: macos-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Setup
uses: ./.github/actions/setup

- name: Calculate fingerprint
id: fingerprint
working-directory: example
run: |
fingerprint=$(yarn expo-updates fingerprint:generate --platform ios | jq -er .hash)
echo "fingerprint=$fingerprint" >> "$GITHUB_OUTPUT"

- name: Cache release build
id: cache
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: react-native-paper-example.app
key: ios-${{ steps.fingerprint.outputs.fingerprint }}

- name: Build iOS app
if: steps.cache.outputs.cache-hit != 'true'
working-directory: example
run: |
yarn expo prebuild --platform ios --no-install
cd ios
pod install
xcodebuild build \
-workspace ReactNativePaperExample.xcworkspace \
-scheme ReactNativePaperExample \
-configuration Release \
-destination 'generic/platform=iOS Simulator' \
-derivedDataPath build \
ARCHS=arm64
mv build/Build/Products/Release-iphonesimulator/ReactNativePaperExample.app ../../react-native-paper-example.app

# Repacking in place fails with ENOTEMPTY on an existing app directory.
- name: Repack cached build
if: steps.cache.outputs.cache-hit == 'true'
working-directory: example
run: |
mv ../react-native-paper-example.app "$RUNNER_TEMP/cached.app"
yarn dlx @expo/repack-app@0.10.3 \
--platform ios \
--source-app "$RUNNER_TEMP/cached.app" \
--output ../react-native-paper-example.app

# `ditto` keeps the symlinks and executable bits a plain upload drops.
- name: Archive app
run: ditto -c -k --keepParent react-native-paper-example.app react-native-paper-example.app.zip

- name: Upload app
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
path: react-native-paper-example.app.zip
archive: false
retention-days: 30
Loading