Optimize CI/CD workflow #18
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 | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
types: [ opened, synchronize, reopened, ready_for_review ] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
strategy: | |
matrix: | |
platform: [ android, ios, web, desktop ] | |
include: | |
- platform: android | |
os: ubuntu-latest | |
- platform: web | |
os: ubuntu-latest | |
- platform: ios | |
os: macos-latest | |
- platform: desktop | |
os: macos-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Java and Gradle set up | |
if: matrix.platform != 'ios' | |
uses: ./.github/workflows/setup/java-setup | |
- name: iOS set up | |
if: matrix.platform == 'ios' | |
uses: ./.github/workflows/setup/ios-setup | |
# Android | |
- name: Grant execute permission for Android script | |
if: matrix.platform == 'android' | |
run: chmod +x ./scripts/build_android.sh | |
- name: Build Android | |
if: matrix.platform == 'android' | |
run: ./scripts/build_android.sh | |
# iOS | |
- name: Grant execute permission for iOS script | |
if: matrix.platform == 'ios' | |
run: chmod +x ./scripts/build_ios.sh | |
- name: Build iOS | |
if: matrix.platform == 'ios' | |
run: ./scripts/build_ios.sh | |
# Web | |
- name: Grant execute permission for Web script | |
if: matrix.platform == 'web' | |
run: chmod +x ./scripts/build_web.sh | |
- name: Build Web | |
if: matrix.platform == 'web' | |
run: ./scripts/build_web.sh | |
- name: Deploy Web | |
if: matrix.platform == 'web' | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./sample/composeApp/build/dist/wasmJs/productionExecutable | |
# MacOS | |
- name: Grant execute permission for MacOS script | |
if: matrix.platform == 'desktop' | |
run: chmod +x ./scripts/build_macos.sh | |
- name: Build MacOS | |
if: matrix.platform == 'desktop' | |
run: ./scripts/build_macos.sh |