Skip to content

Publish on GitHub & Modrinth #10

Publish on GitHub & Modrinth

Publish on GitHub & Modrinth #10

Workflow file for this run

name: Publish on GitHub & Modrinth
on:
workflow_dispatch:
inputs:
java-version:
type: string
mod-version:
type: string
minecraft-version:
type: string
minecraft-target-versions:
type: string
permissions:
contents: write
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Check out project sources
uses: actions/checkout@v4
with:
sparse-checkout: .github/
- name: Get Gradle properties
id: get-gradle-properties
uses: ./.github/actions/read-gradle-properties
with:
keys: java_version, mod_version, minecraft_version, minecraft_target_versions
- name: Resolve environment variables
run: |
echo "${{ steps.get-gradle-properties.outputs.entries }}" >> $GITHUB_ENV
if [ -n "${{ inputs.java-version }}" ]; then \
echo "JAVA_VERSION=${{ inputs.java-version }}" >> $GITHUB_ENV; \
fi
if [ -n "${{ inputs.mod-version }}" ]; then \
echo "MOD_VERSION=${{ inputs.mod-version }}" >> $GITHUB_ENV; \
fi
if [ -n "${{ inputs.minecraft-version }}" ]; then \
echo "MINECRAFT_VERSION=${{ inputs.minecraft-version }}" >> $GITHUB_ENV; \
fi
if [ -n "${{ inputs.minecraft-target-versions }}" ]; then \
echo "MINECRAFT_TARGET_VERSIONS=${{ inputs.minecraft-target-versions }}" >> $GITHUB_ENV; \
fi
shell: bash
- name: Build Gradle project
uses: ./.github/actions/build-gradle-project
with:
java-version: ${{ env.JAVA_VERSION }}
- name: Publish project
uses: Kir-Antipov/[email protected]
with:
name: v${{ env.MOD_VERSION }} for Minecraft ${{ env.MINECRAFT_VERSION }}
version: ${{ env.MOD_VERSION }}+${{ env.MINECRAFT_VERSION }}
version-type: release
java: ${{ env.JAVA_VERSION }}
game-versions: ${{ env.MINECRAFT_TARGET_VERSIONS }}
files: build/libs/!(*-sources).jar
github-generate-changelog: true
github-tag: v${{ env.MOD_VERSION }}+${{ env.MINECRAFT_VERSION }}
github-token: ${{ secrets.PUBLISH_GITHUB_TOKEN }}
modrinth-id: ${{ vars.MODRINTH_ID }}
modrinth-featured: true
modrinth-token: ${{ secrets.PUBLISH_MODRINTH_TOKEN }}