Skip to content

Update main.ts

Update main.ts #20

name: Run Sherlo with Async Upload
on:
pull_request:
branches: [dev]
types: [labeled]
push:
branches: [michal/eas-build-hooks] # Add this line to trigger on push to the specified branch
workflow_dispatch:
inputs:
skip_build:
description: 'Skip the build steps'
required: false
default: 'false'
type: boolean
jobs:
## Sherlo
run_sherlo_async:
name: Run Sherlo in async mode
if: >
(github.event_name == 'pull_request' && github.event.action == 'labeled' && startsWith(github.event.label.name, 'sherlo:async')) ||
(github.event_name == 'workflow_dispatch') ||
(github.event_name == 'push' && github.ref == 'refs/heads/michal/eas-build-hooks')
runs-on: ubuntu-latest
outputs:
buildIndex: ${{ steps.sherlo_action.outputs.buildIndex }} # Map step output to job output
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18.18.0'
- name: Install dependencies
run: yarn
- name: Build dependencies
run: yarn build
- name: Run Sherlo Action with Async Upload
id: sherlo_action # This ID is used to reference the output
uses: ./.
with:
projectRoot: examples/expo-example
asyncUpload: true
env:
SHERLO_TOKEN: ${{ secrets.SHERLO_TOKEN }}
## Android
android_preview_build:
name: Prepare Android Preview Build
needs: [run_sherlo_async]
uses: sherlo-io/sherlo/.github/workflows/android_build.yml@michal/eas-build-hooks
with:
skip_build: ${{ github.event.inputs.skip_build || github.event.label.name == 'sherlo:async:skip_build' || (github.event_name == 'push' && github.ref == 'refs/heads/michal/eas-build-hooks') }}
profile: 'preview'
android_preview_build_upload:
name: Upload Android Preview Build to Sherlo
needs: [run_sherlo_async, android_preview_build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18.18.0'
- name: Install dependencies
run: yarn
- name: Build dependencies
run: yarn build
- name: Download Android Artifact
uses: actions/download-artifact@v2
with:
name: android
path: examples/expo-example/builds/preview
- name: Upload Android to Sherlo
uses: ./.
with:
projectRoot: examples/expo-example
android: builds/preview/android.apk
asyncUploadBuildIndex: ${{ needs.run_sherlo_async.outputs.buildIndex }}
env:
SHERLO_TOKEN: ${{ secrets.SHERLO_TOKEN }}
## iOS
ios_preview_build:
name: Prepare iOS Preview Build
needs: [run_sherlo_async]
uses: sherlo-io/sherlo/.github/workflows/ios_build.yml@michal/eas-build-hooks
with:
skip_build: ${{ github.event.inputs.skip_build || github.event.label.name == 'sherlo:async:skip_build' || (github.event_name == 'push' && github.ref == 'refs/heads/michal/eas-build-hooks') }}
profile: 'preview'
ios_preview_build_upload:
name: Upload iOS Preview Build to Sherlo
needs: [run_sherlo_async, ios_preview_build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18.18.0'
- name: Install dependencies
run: yarn
- name: Build dependencies
run: yarn build
- name: Download iOS Artifact
uses: actions/download-artifact@v2
with:
name: ios
path: examples/expo-example/builds/preview
- name: Upload iOS to Sherlo
uses: ./.
with:
projectRoot: examples/expo-example
ios: builds/preview/ios.tar.gz
asyncUploadBuildIndex: ${{ needs.run_sherlo_async.outputs.buildIndex }}
env:
SHERLO_TOKEN: ${{ secrets.SHERLO_TOKEN }}