Skip to content

Publish

Publish #288

Workflow file for this run

name: "Publish"
on:
workflow_dispatch:
inputs:
mod_loaders:
description: 'List of mod loaders to be published'
required: true
default: "['fabric', 'neoforge']"
type: string
versions:
description: 'List of versions to be published'
required: true
default: "['1.21.1', '1.21.4', '1.21.5', '1.21.8']"
type: string
jobs:
generate-publish-matrix:
runs-on: ubuntu-latest
name: Generate publish matrix
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: "Checkout repository"
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: "Generate matrix for the publish job"
id: set-matrix
run: ./.github/scripts/generate-publish-matrix.sh "${{ inputs.mod_loaders }}" "${{ inputs.versions }}" ${{ vars.CURSEFORGE_FABRIC_PROJECT_ID }} ${{ vars.CURSEFORGE_FORGE_PROJECT_ID }} ${{ vars.MODRINTH_FABRIC_PROJECT_ID }} ${{ vars.MODRINTH_FORGE_PROJECT_ID }}
create-github-release:
runs-on: ubuntu-latest
name: Create github release
steps:
- name: "Checkout repository"
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: "Parse gradle properties"
id: gradle-properties
run: ./.github/scripts/parse-gradle-properties.sh ${{ matrix.version }}
- name: "Parse changelog"
run: ./.github/scripts/parse-changelog.sh ${{ steps.gradle-properties.outputs.MOD_VERSION }}
- name: "Create github release"
continue-on-error: true
uses: ncipollo/release-action@v1
with:
skipIfReleaseExists: true
allowUpdates: true
omitBodyDuringUpdate: true
omitDraftDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true
tag: ${{ steps.gradle-properties.outputs.MOD_VERSION }}
name: ${{ steps.gradle-properties.outputs.MOD_NAME }} ${{ steps.gradle-properties.outputs.MOD_VERSION }}
bodyFile: RELEASE_CHANGELOG.md
publish-to-platforms:
runs-on: ubuntu-latest
needs: [generate-publish-matrix, create-github-release]
name: Publish ${{ matrix.mod_loader }} ${{ matrix.version }}
timeout-minutes: 60
strategy:
max-parallel: 3
fail-fast: false
matrix: ${{ fromJson(needs.generate-publish-matrix.outputs.matrix) }}
steps:
- name: "Checkout repository"
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: "Set up JDK"
uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
- name: "Setup Gradle"
uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: true
gradle-version: wrapper
add-job-summary: 'on-failure'
- name: "Run build"
run: ./gradlew ${{ matrix.mod_loader }}:${{ matrix.version }}:build
- name: "Parse gradle properties"
id: gradle-properties
run: ./.github/scripts/parse-gradle-properties.sh ${{ matrix.version }}
- name: "Parse changelog"
run: ./.github/scripts/parse-changelog.sh ${{ steps.gradle-properties.outputs.MOD_VERSION }}
- name: Publish ${{ matrix.mod_loader }}
uses: Kir-Antipov/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
github-tag: ${{ steps.gradle-properties.outputs.MOD_VERSION }}
curseforge-id: ${{ matrix.curseforge_project_id }}
curseforge-token: ${{ secrets.CURSEFORGE_RELEASE_TOKEN }}
modrinth-featured: true
modrinth-id: ${{ matrix.modrinth_project_id }}
modrinth-token: ${{ secrets.MODRINTH_RELEASE_TOKEN }}
name: ${{ steps.gradle-properties.outputs.MOD_NAME }} ${{ steps.gradle-properties.outputs.MOD_VERSION }}
version: ${{ matrix.mod_loader }}-${{ steps.gradle-properties.outputs.MOD_VERSION }}+mc${{ steps.gradle-properties.outputs.MINECRAFT_VERSION }}
loaders: ${{ join(matrix.supported_mod_loaders, ' ') }}
game-versions: |
>=${{ steps.gradle-properties.outputs.MIN_MINECRAFT_VERSION }} <=${{ steps.gradle-properties.outputs.MINECRAFT_VERSION }}
game-version-filter: releases
changelog-file: RELEASE_CHANGELOG.md
files: |
${{ matrix.mod_loader }}/versions/${{ matrix.version }}/build/libs/!(*-@(dev|dev-shadow|sources|javadoc)).jar
retry-attempts: 6
retry-delay: 30000