Build JAR for release #4
Workflow file for this run
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 will build a Java project with Gradle | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle | |
name: Build JAR for release | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- arch: amd64 | |
qemu_arch: x86_64 | |
tag_suffix: '' | |
latest_tag: latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Cache Gradle packages | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Build native image with Gradle | |
run: ./gradlew build | |
- name: Upload JAR as an artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: "InvUiLib Jar" | |
path: build/libs/invuilib-*.jar | |
if-no-files-found: error | |
- name: Publish package | |
uses: gradle/gradle-build-action@v2 | |
# Only run on amd64 | |
if: matrix.arch == 'amd64' | |
with: | |
arguments: publish | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} | |
- name: Upload JARs to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: "build/libs/invuilib-*.jar" | |
tag: ${{ github.ref }} | |
overwrite: true | |
file_glob: true |