Skip to content

Commit

Permalink
chore: update github workflow and include mac arm artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
xeruf committed Jun 28, 2024
1 parent 1d12fb9 commit d8f30ed
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 10 deletions.
52 changes: 43 additions & 9 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ jobs:
strategy:
fail-fast: false
matrix:
# https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
jdk: [11]
steps:
Expand All @@ -13,12 +14,12 @@ jobs:
submodules: true
fetch-depth: 9
- name: Set up JDK ${{ matrix.jdk }}
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ matrix.jdk }}
- name: Cache Gradle packages
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
Expand All @@ -30,22 +31,55 @@ jobs:
- name: Assemble fat jar
run: ./gradlew shadowJar
- name: Upload jars as artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: software-challenge-gui-${{ github.sha }}-jars
name: software-challenge-gui-${{ github.sha }}-{{ runner.os }}
path: build/*.jar
build-arm:
runs-on: ${{ matrix.os }}
#if: startsWith(github.ref, 'refs/tags/')
strategy:
matrix:
os: [macos-latest-large]
jdk: [11]
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 2
- name: Set up JDK ${{ matrix.jdk }}
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ matrix.jdk }}
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Assemble fat jar
run: ./gradlew shadowJar
- name: Upload jars as artifact
uses: actions/upload-artifact@v4
with:
name: software-challenge-gui-${{ github.sha }}-{{ runner.os }}
path: build/*.jar
release:
needs: build
needs: [build, build-arm]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4 # https://github.com/actions/download-artifact
with:
name: software-challenge-gui-${{ github.sha }}-jars
pattern: software-challenge-gui-${{ github.sha }}-*
path: build
merge-multiple: true
- name: Release ${{ github.ref }}
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v1 # https://github.com/softprops/action-gh-release
with:
files: build/*.jar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ tasks {

shadowJar {
destinationDirectory.set(buildDir)
archiveClassifier.set(OperatingSystem.current().familyName)
archiveClassifier.set("${OperatingSystem.current().familyName.replace(" ", "")}-${System.getProperty("os.arch")}")
manifest {
attributes(
"Add-Opens" to arrayOf(
Expand Down

0 comments on commit d8f30ed

Please sign in to comment.