Skip to content

Commit

Permalink
skip steps if build is not required
Browse files Browse the repository at this point in the history
  • Loading branch information
michalziolkowski committed Mar 25, 2024
1 parent 5fbb10d commit 379b475
Showing 1 changed file with 65 additions and 49 deletions.
114 changes: 65 additions & 49 deletions .github/workflows/build_and_run_sherlo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,38 +16,44 @@ on:

jobs:
android_preview_build:
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && (contains(github.event.pull_request.labels.*.name, 'sherlo') || contains(github.event.pull_request.labels.*.name, 'sherlo:skip_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: Set up Node.js
if: ${{ !contains(join(github.event.pull_request.labels.*.name), 'sherlo:skip_build')) }}
uses: actions/setup-node@v2
with:
node-version: '18.18.0'

# - name: Setup Java Environment
# uses: actions/setup-java@v2
# with:
# java-version: '17'
# distribution: 'temurin'
- name: Setup Java Environment
if: ${{ !contains(join(github.event.pull_request.labels.*.name), 'sherlo:skip_build')) }}
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'

# - name: Install dependencies
# run: yarn
- name: Install dependencies
if: ${{ !contains(join(github.event.pull_request.labels.*.name), 'sherlo:skip_build')) }}
run: yarn

# - name: Build dependencies
# run: yarn build
- name: Build dependencies
if: ${{ !contains(join(github.event.pull_request.labels.*.name), 'sherlo:skip_build')) }}
run: yarn build

# - name: Setup EAS
# uses: expo/expo-github-action@v8
# with:
# eas-version: latest
# token: ${{ secrets.EXPO_TOKEN }}
- name: Setup EAS
if: ${{ !contains(join(github.event.pull_request.labels.*.name), 'sherlo:skip_build')) }}
uses: expo/expo-github-action@v8
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}

# - name: Build Android example app
# add condition to not build if sherlo:only_test
# run: yarn workspace @sherlo/expo-example android:build:preview
- name: Build Android example app
if: ${{ !contains(join(github.event.pull_request.labels.*.name), 'sherlo:skip_build')) }}
run: yarn workspace @sherlo/expo-example android:build:preview

- name: Upload Android Artifact
uses: actions/upload-artifact@v2
Expand All @@ -56,45 +62,53 @@ jobs:
path: examples/expo-example/builds/preview/android.apk

ios_preview_build:
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && (contains(github.event.pull_request.labels.*.name, 'sherlo') || contains(github.event.pull_request.labels.*.name, 'sherlo:skip_build'))) }}
runs-on: macos-13
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: Select Xcode Version
# uses: maxim-lobanov/setup-xcode@v1
# with:
# xcode-version: '15.0.1'
# - run: |
# xcode-select -print-path
# - run: |
# xcodebuild -version
- name: Set up Node.js
if: ${{ !contains(join(github.event.pull_request.labels.*.name), 'sherlo:skip_build')) }}
uses: actions/setup-node@v2
with:
node-version: '18.18.0'

# - name: Setup Cocoapods
# uses: maxim-lobanov/setup-cocoapods@v1
# with:
# version: latest
- name: Select Xcode Version
if: ${{ !contains(join(github.event.pull_request.labels.*.name), 'sherlo:skip_build')) }}
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.0.1'
- run: |
xcode-select -print-path
- run: |
xcodebuild -version
- name: Setup Cocoapods
if: ${{ !contains(join(github.event.pull_request.labels.*.name), 'sherlo:skip_build')) }}
uses: maxim-lobanov/setup-cocoapods@v1
with:
version: latest

# - name: Install dependencies
# run: yarn
- name: Install dependencies
if: ${{ !contains(join(github.event.pull_request.labels.*.name), 'sherlo:skip_build')) }}
run: yarn

# - name: Build dependencies
# run: yarn build
- name: Build dependencies
if: ${{ !contains(join(github.event.pull_request.labels.*.name), 'sherlo:skip_build')) }}
run: yarn build

# - name: Setup EAS
# uses: expo/expo-github-action@v8
# with:
# eas-version: latest
# token: ${{ secrets.EXPO_TOKEN }}
- name: Setup EAS
if: ${{ !contains(join(github.event.pull_request.labels.*.name), 'sherlo:skip_build')) }}
uses: expo/expo-github-action@v8
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}

# - name: Build iOS example app
# run: yarn workspace @sherlo/expo-example ios:build:preview
- name: Build iOS example app
if: ${{ !contains(join(github.event.pull_request.labels.*.name), 'sherlo:skip_build')) }}
run: yarn workspace @sherlo/expo-example ios:build:preview

- name: Upload iOS Artifact
uses: actions/upload-artifact@v2
Expand All @@ -103,6 +117,7 @@ jobs:
path: examples/expo-example/builds/preview/ios.tar.gz

run_sherlo_action:
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && (contains(github.event.pull_request.labels.*.name, 'sherlo') || contains(github.event.pull_request.labels.*.name, 'sherlo:skip_build'))) }}
runs-on: ubuntu-latest
needs: [android_preview_build, ios_preview_build]
steps:
Expand Down Expand Up @@ -130,6 +145,7 @@ jobs:
private_key: ${{ secrets.SHERLO_BOT_PRIVATE_KEY }}

- name: Commit and push Preview builds
if: ${{ !contains(join(github.event.pull_request.labels.*.name), 'sherlo:skip_build')) }}
env:
BRANCH_NAME: ${{ github.event_name == 'pull_request' && github.head_ref || format('refs/heads/{0}', github.ref_name) }}
run: |
Expand Down

0 comments on commit 379b475

Please sign in to comment.