Publish on GitHub & Modrinth #4
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: Publish on GitHub & Modrinth | |
on: [ pull_request, workflow_dispatch ] | |
env: | |
MODRINTH_TOKEN: ${{ secrets.PUBLISH_MODRINTH_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.PUBLISH_GITHUB_TOKEN }} | |
permissions: | |
contents: write | |
jobs: | |
build: | |
strategy: | |
matrix: | |
java: [ | |
21, # Current Java LTS | |
] | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Check Environment Variables | |
run: env | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: validate gradle wrapper | |
uses: gradle/wrapper-validation-action@v2 | |
- name: setup jdk ${{ matrix.java }} | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "temurin" | |
java-version: ${{ matrix.java }} | |
- name: make gradle wrapper executable | |
run: chmod +x ./gradlew | |
- name: Build | |
run: ./gradlew build | |
- name: Publish (Modrinth/GitHub) | |
if: ${{ matrix.java == '21' }} | |
uses: Kir-Antipov/[email protected] | |
with: | |
modrinth-id: 5SesFmyd | |
modrinth-token: "${{env.MODRINTH_TOKEN}}" | |
github-token: "${{env.GITHUB_TOKEN}}" | |
version-type: release | |
github-generate-changelog: true | |
loaders: fabric | |
java: "${{ matrix.java }}" |