workflow (ionic): upgraded files to use latest actions and commands #39
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: Create an iOS Simulator build | |
on: | |
push: | |
paths: | |
- '*' | |
- '.github/workflows/build-ios-simulator.yml' | |
- 'ios/**' | |
- 'src/**' | |
- '!**/*.md' | |
branches: | |
- ionic | |
jobs: | |
build-ios-simulator: | |
name: Create an iOS Simulator build | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# Setup Web environment to install packages. | |
- name: Setup Web environment | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
cache: 'npm' | |
- name: Restore node_modules from cache | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }} | |
restore-keys: ${{ runner.os }}-node-modules- | |
- name: Install Ionic CLI | |
run: npm install -g @ionic/cli | |
- name: Install packages | |
run: npm ci | |
# # improve iOS build compilation time | |
# - name: Restore buildcache | |
# uses: mikehardy/buildcache-action@v2 | |
# continue-on-error: true | |
- name: Restore Pods cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
ios/Pods | |
~/Library/Caches/CocoaPods | |
~/.cocoapods | |
key: ${{ runner.os }}-pods-${{ hashFiles('ios/Podfile.lock') }} | |
restore-keys: ${{ runner.os }}-pods- | |
- name: Build the ionic project for iOS | |
run: ionic capacitor build ios --prod --no-open | |
# - name: Restore build artifacts from cache | |
# uses: actions/cache@v4 | |
# with: | |
# path: ~/Library/Developer/Xcode/DerivedData | |
# key: ${{ runner.os }}-ios-derived-data-${{ hashFiles('ios/Podfile.lock') }} | |
# restore-keys: | | |
# ${{ runner.os }}-ios-derived-data- | |
# - name: Run app on iOS | |
# run: npx react-native run-ios --simulator 'iPhone 14 Pro Max' --configuration Release | |
# - name: Store build .app file as zip | |
# working-directory: ios | |
# run: | | |
# cd ~/Library/Developer/Xcode/DerivedData/rn_test_github_actions-*/Build/Products/Release-iphonesimulator | |
# mkdir -p output | |
# zip -r -y -o output/rn_test_github_actions.zip rn_test_github_actions.app | |
# - name: Save build file as artifact | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: rn-ios-simulator-build | |
# path: ~/Library/Developer/Xcode/DerivedData/rn_test_github_actions-*/Build/Products/Release-iphonesimulator/output | |
- name: Install xcpretty | |
run: gem install xcpretty | |
- name: Run simulator build command | |
working-directory: ios/App | |
run: | | |
set -o pipefail | |
xcodebuild \ | |
-scheme App \ | |
-workspace App.xcworkspace \ | |
-sdk iphonesimulator \ | |
-configuration Release \ | |
-derivedDataPath build | xcpretty | |
- name: Store build .app file as zip | |
working-directory: ios/App | |
run: | | |
cd build/Build/Products/Release-iphonesimulator | |
mv App.app ionic_github_action_ios.app | |
mkdir -p output | |
zip -r -y -o output/ionic_github_action_ios.zip ionic_github_action_ios.app | |
- name: Save build file as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ionic-ios-simulator-build | |
path: ios/App/build/Build/Products/Release-iphonesimulator/output |