Update workflows to support building and uploading to Appetize #3
Workflow file for this run
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: iOS Appetize | |
on: pull_request | |
jobs: | |
build-and-upload-to-appetize: | |
runs-on: macos-latest | |
timeout-minutes: 30 | |
name: Build and upload app to Appetize 🚀 | |
steps: | |
- name: Cancel previous jobs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- name: Git Checkout | |
uses: actions/checkout@v3 | |
- name: Select Xcode Version | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: latest-stable | |
- name: Install SSH key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.SSH_KEY }} | |
name: id_rsa_github_actions | |
known_hosts: unnecessary | |
- uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.SSH_KEY }} | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: "2.6" | |
bundler-cache: true | |
- uses: actions/setup-ruby@v1 | |
with: | |
ruby-version: '2.6' | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'yarn' | |
- name: Add slack message builder | |
run: | | |
yarn add slack-message-builder | |
- name: Get npm cache directory | |
id: npm-cache-dir | |
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT} | |
- name: Cache npm dependencies | |
uses: actions/cache@v3 | |
id: npm-cache | |
with: | |
path: ${{ steps.npm-cache-dir.outputs.dir }} | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Set legacy-peer-deps for npm config | |
run: | | |
npm config set legacy-peer-deps true | |
- name: Cache pods | |
uses: actions/cache@v3 | |
with: | |
path: | | |
ios/Pods | |
~/Library/Caches/CocoaPods | |
~/.cocoapods | |
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-pods- | |
- name: Install packages | |
run: | | |
yarn | |
- name: Install Tuist.io | |
run: | | |
if [ ! -d ".tuist-bin" ] | |
then | |
curl -Ls https://install.tuist.io | bash | |
fi | |
- name: Create the Xcode project and workspace | |
run: sh ./example/ios/example_0_70_6/tuist-generate.sh is_ci | |
- name: Create main.jsbundle | |
run: | | |
yarn --cwd example build:ios | |
- name: Distribute the React Native iOS app on Appetize 🚀 | |
run: | | |
bundle exec fastlane ios appetize_build_and_upload | |
env: | |
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} | |
MATCH_GIT_PRIVATE_KEY: ${{ secrets.SSH_KEY }} | |
FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }} | |
FASTLANE_SESSION: ${{ secrets.FASTLANE_SESSION }} | |
MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }} | |
MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }} | |
APPETIZE_API_TOKEN: ${{ secrets.APPETIZE_API_TOKEN }} | |
SOURCE_BRANCH: ${{ github.head_ref }} | |
PR_NUMBER: ${{ github.event.pull_request.number }} | |
- uses: peter-evans/find-comment@v2 | |
if: ${{ success() }} | |
id: find_comment | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
body-includes: Appetize iOS link | |
- uses: peter-evans/create-or-update-comment@v2 | |
if: ${{ success() }} | |
with: | |
body: | | |
Appetize iOS link: ${{ env.APPETIZE_APP_URL }} | |
edit-mode: replace | |
comment-id: ${{ steps.find_comment.outputs.comment-id }} | |
issue-number: ${{ github.event.pull_request.number }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Slack Success Summary Report | |
if: ${{ success() && github.event.pull_request.base.ref == 'master' }} | |
run: | | |
node Report\ Scripts/appetize-success-report-script.js createAppetizeSummaryReport ${{ github.head_ref || github.ref_name }} 'RN iOS' | |
- name: Slack Success Notification | |
if: ${{ success() && github.event.pull_request.base.ref == 'master' }} | |
uses: slackapi/[email protected] | |
with: | |
channel-id: ${{ secrets.SLACK_MOBILE_SDK_CHANNEL }} | |
payload-file-path: '/var/tmp/appetize-success-link-summary.json' | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_REPORTER_BOT_TOKEN }} | |
- name: Create Slack Failure Summary Report | |
if: ${{ failure() && github.event.pull_request.base.ref == 'master' }} | |
run: | | |
node Report\ Scripts/appetize-failure-report-script.js createAppetizeSummaryReport ${{ github.head_ref || github.ref_name }} 'RN iOS' | |
- name: Slack Notification | |
if: ${{ failure() && github.event.pull_request.base.ref == 'master' }} | |
uses: slackapi/[email protected] | |
with: | |
channel-id: ${{ secrets.SLACK_MOBILE_SDK_CHANNEL }} | |
payload-file-path: '/var/tmp/appetize-failure-link-summary.json' | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_REPORTER_BOT_TOKEN }} | |
- name: Save Simulator app | |
uses: actions/upload-artifact@v3 | |
id: save_simulator_app_id_step | |
with: | |
name: PrimerSDK_Debug_Build | |
path: /var/tmp/PrimerSDK_Debug_Build.zip | |
if-no-files-found: error | |