Build #42
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
name: Build | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
publish: | |
description: Publish To Modrinth and Curseforge | |
required: true | |
default: "false" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} | |
PUBLISHING: ${{ github.event.inputs.publish }} | |
steps: | |
- name: checkout repository | |
uses: actions/checkout@v4 | |
- name: setup java | |
run: echo "JAVA_HOME=$JAVA_HOME_17_X64" >> "$GITHUB_ENV" | |
- name: validate gradle wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
- name: loom cache | |
uses: actions/cache@v4 | |
with: | |
path: "**/.gradle/loom-cache" | |
key: "${{ runner.os }}-gradle-${{ hashFiles('**/libs.versions.*', '**/*.gradle*', '**/gradle-wrapper.properties') }}" | |
restore-keys: "${{ runner.os }}-gradle-" | |
- name: setup gradle | |
uses: gradle/actions/setup-gradle@v4 | |
with: | |
gradle-home-cache-cleanup: true | |
- name: validate gradle wrapper | |
uses: gradle/wrapper-validation-action@v2 | |
- name: build or publish | |
run: ./gradlew buildOrPublish | |
- name: capture build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Artifacts | |
path: build/libs/ | |
- name: modrinth and curseforge | |
if: ${{ github.event.inputs.publish }} | |
run: ./gradlew publishMod |