Skip to content

Publish Project

Publish Project #10

Workflow file for this run

# Publishes the project to GitHub Releases, CurseForge, and Modrinth
name: Publish Project
on:
workflow_dispatch:
inputs:
version:
description: 'Mod version'
required: true
release_type:
description: 'Release type'
type: choice
default: 'beta'
options:
- 'release'
- 'beta'
- 'alpha'
env:
# link to the changelog with a format code for the version
CHANGELOG_LOCATION: "Changelog is available [here](https://github.com/${{ github.repository }}/releases/tag/GTBeesMatrix-v${{ github.event.inputs.version }}-${{ github.event.inputs.release_type }})"
# Version of the mod
FULL_VERSION: "${{ github.event.inputs.version }}-${{ github.event.inputs.release_type }}"
# type of release
NAME: "GTBeesMatrix"
# Curseforge and Modrinth project IDs
CURSEFORGE_PROJECT_ID: "1479601"
MODRINTH_PROJECT_ID: "uqXnhP5O"
concurrency:
group: publish-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
publish:
name: Publish
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Repository
uses: actions/checkout@v6
with:
ref: ${{ inputs.target_branch || github.ref }}
fetch-tags: true
- name: Check if tag already exists
run: |
if git rev-parse --verify --quiet "v${{ github.event.inputs.version }}"; then
echo "Version ${{ github.event.inputs.version }} already exists, aborting workflow."
exit 1
fi
- name: Set version
run: sed -i "s/modVersion.*=.*/modVersion = ${{ env.FULL_VERSION }}/g" buildscript.properties
- name: Commit and push buildscript.properties
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: "Bump version to v${{ env.FULL_VERSION }}"
commit_options: '--no-verify'
file_pattern: buildscript.properties
tagging_message: "v${{ env.FULL_VERSION }}"
- name: Setup Build
uses: ./.github/actions/build_setup
- name: Build Project
run: ./gradlew --info build
- name: Publish to Curseforge and Modrinth
uses: Kir-Antipov/mc-publish@v3.3
with:
github-tag: "v${{ env.FULL_VERSION }}"
github-generate-changelog: true
github-draft: false
github-prerelease: false
github-token: ${{ secrets.GITHUB_TOKEN }}
modrinth-id: ${{ env.MODRINTH_PROJECT_ID }}
modrinth-token: "${{ secrets.MODRINTH_API_KEY }}"
modrinth-dependencies: |
tULldUx4(required)
curseforge-id: ${{ env.CURSEFORGE_PROJECT_ID }}
curseforge-token: "${{ secrets.CURSEFORGE_API_KEY }}"
curseforge-dependencies: |
gregtech-ce-unofficial(required)
gregicality-multiblocks(recommended)
gregtech-food-option(recommended)
forestry(required)
gendustry(recommended)
binnies-mods-patched(recommended)
files: |
build/libs/!(*-@(dev|sources|javadoc)).jar
build/libs/*-@(sources).jar
build/libs/*-@(dev).jar
name: "${{ env.NAME }}-${{ env.FULL_VERSION }}.jar"
changelog: "Changelog is available [here](https://github.com/${{github.repository}}/blob/main/CHANGELOG.md)"
version: "${{ github.event.inputs.version }}"
version-type: "${{ github.event.inputs.release_type }}"
loaders: |
forge
game-versions: |
1.12.2
java: |
8
retry-attempts: 2