Multiplatform Snapshot Build #6
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
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created | |
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle | |
name: Multiplatform Snapshot Build | |
on: | |
push: | |
branches: | |
- dev | |
paths-ignore: | |
- 'assets/**' | |
- '**.md' | |
- 'LICENSE' | |
- '**.gitignore' | |
pull_request_review: | |
types: submitted | |
jobs: | |
build: | |
strategy: | |
matrix: | |
type: [PublishLibrary, Android, Windows, Linux, macOS, iOS, WasmJs, Js] | |
include: | |
- type: PublishLibrary | |
publish: release | |
os: macos-latest | |
- type: Android | |
android: apk | |
os: ubuntu-latest | |
- type: Windows | |
desktop: msi | |
os: windows-latest | |
- type: Linux | |
desktop: deb | |
os: ubuntu-latest | |
- type: macOS | |
desktop: dmg | |
os: macos-latest | |
- type: iOS | |
iOS: ipa | |
os: macos-latest | |
- type: WasmJs | |
js: wasmJs | |
os: windows-latest | |
- type: Js | |
js: js | |
os: ubuntu-latest | |
runs-on: ${{ matrix.os }} | |
if: ${{ github.event_name != 'pull_request_review' || github.event.review.state == 'approved' }} | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.ref }} | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. | |
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 | |
# Publish Snapshot Library | |
- name: Publish Library | |
if: ${{ github.event_name == 'push' && matrix.type == 'PublishLibrary' }} | |
run: | | |
./gradlew publishToMavenLocal | |
./gradlew publish | |
env: | |
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | |
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} | |
SIGNING_KEY: ${{ secrets.SIGNING_KEY }} | |
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} | |
- name: Upload Library Artifact | |
if: ${{ github.event_name == 'push' && matrix.type == 'PublishLibrary' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Repository-${{ github.run_id }} | |
path: ~/.m2/repository | |
# Android Build Action | |
- name: Build Gallery for ${{ matrix.type }} | |
if: ${{ matrix.android }} | |
run: | | |
echo "$ANDROID_KEYSTORE" | base64 --decode > ${{ github.workspace }}/android_sign_key.jks | |
./gradlew :gallery:assembleRelease | |
env: | |
ANDROID_KEYSTORE: ${{ secrets.ANDROID_KEYSTORE }} | |
ANDROID_SIGNING_FILE: ${{ github.workspace }}/android_sign_key.jks | |
ANDROID_SIGNING_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
ANDROID_SIGNING_KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
ANDROID_SIGNING_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
- name: Upload android build artifacts | |
if: ${{ matrix.android }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Gallery-${{ matrix.type }}-${{ github.run_id }} | |
path: ${{github.workspace}}/gallery/build/outputs/**/*.${{ matrix.android }} | |
# Desktop Build Action | |
- name: Build Gallery for ${{ matrix.type }} | |
if: ${{ matrix.desktop }} | |
run: | | |
./gradlew :gallery:packageReleaseDistributionForCurrentOS | |
- name: Upload desktop build artifacts | |
if: ${{ matrix.desktop }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Gallery-${{ matrix.type }}-${{ github.run_id }} | |
path: ${{github.workspace}}/gallery/build/compose/binaries/main-release/${{ matrix.desktop }}/*.${{ matrix.desktop }} | |
# iOS Build Action, Note: Due to the long build time, the iOS build only build the debug version. | |
- name: Set up Xcode | |
if: ${{ matrix.iOS }} | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: 'latest-stable' | |
- name: Build Gallery for iOS | |
if: ${{ matrix.iOS }} | |
run: | | |
xcodebuild -scheme iosApp -configuration Debug -sdk iphoneos -archivePath gallery/iosApp/build/Gallery.xcarchive archive -workspace gallery/iosApp/iosApp.xcodeproj/project.xcworkspace CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | |
- name: Upload iOS Artifact | |
if: ${{ matrix.iOS }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Gallery-${{ matrix.type }}-${{ github.run_id }} | |
path: ${{ github.workspace }}/gallery/iosApp/build/ | |
# Js and WasmJs Build Action | |
- name: Build Gallery for ${{ matrix.type }} | |
if: ${{ matrix.js }} | |
run: | | |
./gradlew :gallery:${{ matrix.js }}BrowserDistribution | |
- name: Upload ${{ matrix.type }} build artifacts | |
if: ${{ matrix.js }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Gallery-${{ matrix.type }}-${{ github.run_id }} | |
path: ./gallery/build/dist/${{ matrix.js }}/productionExecutable |