Create build-and-screenshot.yml #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Screenshot | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
build-ios: | |
name: Build iOS App | |
runs-on: macos-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Install dependencies | |
run: npm install | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '2.7' | |
- name: Prebuild | |
run: | | |
npx expo prebuild -p ios --no-install | |
- name: Install CocoaPods | |
run: | | |
sudo gem install cocoapods | |
cd ios | |
pod install | |
cd .. | |
- name: Install Xcode Command Line Tools | |
run: xcode-select --install || echo "Xcode Command Line Tools already installed" | |
- name: Build iOS App | |
run: | | |
cd ios | |
xcodebuild -workspace PillarValley.xcworkspace -scheme PillarValley -sdk iphoneos -configuration Release archive -archivePath $PWD/build/PillarValley.xcarchive | |
xcodebuild -exportArchive -archivePath $PWD/build/PillarValley.xcarchive -exportOptionsPlist exportOptions.plist -exportPath $PWD/build | |
- name: Upload iOS Binary | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ios-app-binary | |
path: ios/build/PillarValley.ipa | |
run-screenshot-script: | |
name: Run Screenshot Script | |
runs-on: ubuntu-latest | |
needs: build-ios | |
steps: | |
- name: Download iOS Binary | |
uses: actions/download-artifact@v3 | |
with: | |
name: ios-app-binary | |
path: ./build | |
- name: 🏗️ Setup Bun | |
uses: oven-sh/setup-bun@v1 | |
with: | |
# Version `1.x` fails due to https://github.com/oven-sh/setup-bun/issues/37 | |
# TODO(cedric): swap `latest` back once the issue is resolved | |
bun-version: latest | |
- name: Install Xcode Command Line Tools | |
run: xcode-select --install || echo "Xcode Command Line Tools already installed" | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Install dependencies | |
run: npm install | |
- name: Run Screenshot Script | |
run: bun ./scripts/screenshots.ts ./build/PillarValley.ipa | |
- name: Upload Screenshots | |
uses: actions/upload-artifact@v3 | |
with: | |
name: screenshots | |
path: ./screenshots |