Skip to content

Merge pull request #73 from Konyaco/update_build_script #1

Merge pull request #73 from Konyaco/update_build_script

Merge pull request #73 from Konyaco/update_build_script #1

# 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:
- dev
jobs:
build:
strategy:
matrix:
type: [PublishLibrary, Android, Windows, Linux, macOS]
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
runs-on: ${{ matrix.os }}
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
- 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 }}