Skip to content

feat: Support Minecraft 1.21 #2

feat: Support Minecraft 1.21

feat: Support Minecraft 1.21 #2

Workflow file for this run

name: Release on tag
on:
workflow_dispatch:
push:
tags:
- '*'
env:
JAVA_VERSION: 21
MODRINTH_ID: 'T9FDHbY5'
CURSEFORGE_ID: '484738'
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v4
- name: Validate Gradle wrapper
uses: gradle/actions/wrapper-validation@v3
- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '${{env.JAVA_VERSION}}'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Build with Gradle
run: gradle build
- name: Get version numbers from tag
id: version
run: |
# Extract mod and minecraft version from tag
mod_version=${GITHUB_REF_NAME#v}
mod_version="${mod_version%+*}"
minecraft_version=${GITHUB_REF_NAME#*+}
echo "mod=$mod_version" >> $GITHUB_OUTPUT
echo "minecraft=$minecraft_version" >> $GITHUB_OUTPUT
echo "full=$mod_version+$minecraft_version" >> $GITHUB_OUTPUT
echo Mod version: $mod_version
echo Minecraft version: $minecraft_version
- name: Install parse-changelog
uses: taiki-e/install-action@v2
with:
tool: parse-changelog
- name: Parse changelog
id: changelog
continue-on-error: true
run: |
# Extract the changelog entry for this release
mkdir -p output
changelog=output/changelog.md
parse-changelog CHANGELOG.md ${{ steps.version.outputs.full }} > $changelog || true
if [[ ! -s $changelog ]]; then
# No changelog for specific version (mod+minecraft), try just mod version
parse-changelog CHANGELOG.md ${{ steps.version.outputs.mod }} > $changelog || true
fi
if [[ ! -s $changelog ]]; then
echo "No changelog available" > $changelog
fi
echo Extracted changelog for this release:
cat $changelog
echo "file=$changelog" >> $GITHUB_OUTPUT
- name: Publish release
id: publish
uses: Kir-Antipov/[email protected]
with:
modrinth-id: ${{ env.MODRINTH_ID }}
curseforge-id: ${{ env.CURSEFORGE_ID }}
github-token: ${{ secrets.MY_GITHUB_TOKEN }}
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
name: Status Effect Timer ${{ steps.version.outputs.mod }} (${{ steps.version.outputs.minecraft }})
version: ${{ steps.version.outputs.full }}
version-type: release
changelog-file: ${{ steps.changelog.outputs.file }}
- name: Show results
run: |
# Show results from mc-publish
echo Successfully published Status Effect Timer ${{ steps.version.outputs.full }}
echo Modrinth release ${{ steps.publish.outputs.modrinth-version }}: ${{ steps.publish.outputs.modrinth-url }}
echo CurseForge release ${{ steps.publish.outputs.curseforge-version }}: ${{ steps.publish.outputs.curseforge-url }}
echo GitHub release ${{ steps.publish.outputs.github-tag }}: ${{ steps.publish.outputs.github-url }}