Skip to content

Release Build

Release Build #8

Workflow file for this run

# Automatically build the project and run any configured tests for every push
# and submitted pull request. This can help catch issues that only occur on
# certain platforms or Java versions, and provides a first line of defence
# against bad commits.
name: Release Build
on:
workflow_dispatch:
inputs:
release-type:
type: choice
description: Choose the release type
required: true
options:
- beta
- release
publish-tag:
type: string
required: true
description: Tag name to publish (X.X.X)
jobs:
build:
strategy:
matrix:
minecraft: [1.16.5, 1.17.1, 1.18.2, 1.19.2, 1.19.4, 1.20.1, 1.20.4]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
- name: Make Gradle wrapper executable
run: chmod +x ./gradlew
- name: Setup Forge files
run: ./gradlew forge:setupFiles -Pminecraft_version="${{ matrix.minecraft }}"
- name: Build with Gradle
run: ./gradlew build -Pminecraft_version="${{ matrix.minecraft }}"
- name: Create release
uses: softprops/action-gh-release@v2
with:
body_path: CHANGELOG.md
draft: false
tag_name: ${{ inputs.publish-tag }}
prerelease: ${{ inputs.release-type == 'beta' }}
fail_on_unmatched_files: true
files: build/*.jar
- name: Upload to Modrinth
env:
MODRINTH_KEY: ${{ secrets.MODRINTH_PAT }}
if: ${{ env.MODRINTH_KEY != '' }}
uses: Kir-Antipov/mc-publish@v3.3
with:
modrinth-id: qq2xNfbz
modrinth-token: ${{ secrets.MODRINTH_PAT }}
files: |
build/*.jar
name: '[${{ matrix.minecraft }}] v${{ inputs.publish-tag }}'
version: ${{ inputs.publish-tag }}+${{ matrix.minecraft }}
version-type: ${{ inputs.release-type }}
modrinth-featured: ${{ inputs.release-type == 'release' }}
changelog-file: CHANGELOG.md
loaders: |
fabric
forge
${{ startsWith(matrix.minecraft, '1.20.1') && 'neoforge' || '' }}
game-versions: |
${{ matrix.minecraft }}
dependencies: |
minecraft-transit-railway
retry-attempts: 3
retry-delay: 30000
fail-mode: fail
- name: Upload Artifacts to GitHub
uses: actions/upload-artifact@v4
with:
name: JCM for Minecraft ${{ matrix.minecraft }}
path: build/
publish:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Read CHANGELOG.md
run: 'echo "CHANGELOG=$(cat CHANGELOG.md)" >> $GITHUB_ENV'
- name: Publish announcement Discord
uses: tsickert/discord-webhook@v6.0.0
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK }}
content: '<@866988297740877844> ${{ env.CHANGELOG }}'