- Updated build.yaml: fixed major bugs #13
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: CI | |
on: | |
push: | |
pull_request: | |
jobs: | |
build: | |
name: Build and Test | |
runs-on: macOS-latest | |
strategy: | |
matrix: | |
platform: [android, ios] | |
steps: | |
# Checkout the repository | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Set up JDK for Android builds | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: temurin | |
# Cache Gradle | |
- name: Cache Gradle | |
uses: actions/cache@v3 | |
with: | |
path: ~/.gradle/caches | |
key: gradle-${{ matrix.platform }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
# Build for Android | |
- name: Build Android | |
if: matrix.platform == 'android' | |
run: ./gradlew assembleDebug | |
# Build for iOS | |
- name: Build iOS | |
if: matrix.platform == 'ios' | |
run: ./gradlew :shared:linkDebugFrameworkIosFat | |
# Run tests | |
# - name: Run tests | |
# if: matrix.platform == 'ios' | |
# run: ./gradlew test | |
- name: Upload Build Artifacts | |
if: matrix.platform == 'android' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: release-artifacts | |
path: | | |
androidApp/release/*.apk | |
release: | |
name: Create GitHub Release | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Download Build Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: release-artifacts | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.run_number }} | |
release_name: ${{ github.event.repository.name }} v${{ github.run_number }} | |
- name: Upload Release Assets | |
id: upload_release_asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: androidApp/release/androidApp-release.apk | |
asset_name: androidApp-release.apk | |
asset_content_type: application/vnd.android.package-archive | |
deploy: | |
name: Deploy (Optional) | |
needs: build | |
runs-on: macOS-latest | |
steps: | |
# Example for deployment: publish to GitHub Pages | |
- name: Deploy artifacts | |
run: echo "Add your deployment steps here." |