Update github_snapshot_build.yml #45
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: Gradle Snapshot Build | |
on: | |
push: | |
branches: | |
- test_ios_build | |
jobs: | |
build: | |
strategy: | |
matrix: | |
type: [PublishLibrary] | |
include: | |
- type: PublishLibrary | |
publish: release | |
os: macos-latest | |
# - type: Android | |
# android: apk | |
# os: macos-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 | |
runs-on: ${{ matrix.os }} | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
# 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 | |
# with: | |
# cache-disabled: true | |
# - name: clean dir | |
# run: | | |
# ls -a | |
# rm -rf ${{ github.workspace }}/* | |
# rm -rf ~/.gradle | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: sync_master_target | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- 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: | | |
# rm -rf ~/.gradle/caches/ | |
# ./gradlew :gallery:kspCommonMainKotlinMetadata | |
# ./gradlew :gallery:linkDebugFrameworkIosFat | |
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 CODE_SIGN_IDENTITY="" | |
xcodebuild -exportArchive -archivePath gallery/iosApp/build/Gallery.xcarchive -exportPath gallery/iosApp/build/Gallery -allowProvisioningUpdates -exportOptionsPlist gallery/iosApp/iosApp.xcodeproj/ExportOptions.plist | |
# xcodebuild -workspace gallery/iosApp/iosApp.xcodeproj/project.xcworkspace -scheme iosApp -configuration Debug -derivedDataPath gallery/iosApp/build CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | |
- name: Updaload iOS Artifact | |
if: ${{ matrix.iOS }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Gallery-${{ matrix.type }}-${{ github.run_id }} | |
path: ${{ github.workspace }}/gallery/iosApp/build/ | |
- name: Publish Library | |
if: ${{ matrix.publish }} | |
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: ${{ matrix.publish }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Repository-${{ github.run_id }} | |
path: ~/.m2/repository | |
- 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 }} | |
- 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 }} | |
- name: Upload Failed Project | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Project-${{ matrix.type }}-${{ github.run_id }} | |
path: ${{ github.workspace }} |