publish #31
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: publish | |
on: | |
workflow_dispatch: | |
inputs: | |
release-type: | |
description: "release type" | |
default: release | |
required: true | |
type: choice | |
options: | |
- alpha | |
- beta | |
- release | |
changelog: | |
description: "change log" | |
required: true | |
type: string | |
maven-repository: | |
description: "maven repository" | |
required: true | |
type: boolean | |
default: true | |
github-release: | |
description: "publish github release" | |
type: boolean | |
default: true | |
modrinth: | |
description: "publish modrinth" | |
type: boolean | |
default: true | |
curseforge: | |
description: "publish curseforge" | |
type: boolean | |
default: true | |
forge: | |
description: "forge" | |
type: boolean | |
default: true | |
fabric: | |
description: "fabric" | |
type: boolean | |
default: true | |
jobs: | |
call-build-workflow: | |
permissions: | |
contents: read | |
uses: "./.github/workflows/build.yml" | |
upload-maven: | |
needs: call-build-workflow | |
runs-on: ubuntu-latest | |
if: inputs.maven-repository | |
env: | |
MAVEN_PASS: ${{ secrets.MAVEN_PASS }} | |
MAVEN_USER: ${{ secrets.MAVEN_USER }} | |
steps: | |
- name: Download shimmer artifact | |
uses: actions/download-artifact@v3 | |
continue-on-error: true | |
with: | |
name: Shimmer | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Validate Gradle wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
- name: Grant execute permission for gradle | |
run: chmod +x gradlew | |
- name: Publish to Maven | |
uses: gradle/[email protected] | |
with: | |
arguments: publish | |
publish: | |
needs: call-build-workflow | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
strategy: | |
matrix: | |
loader: [ Forge, Fabric ] | |
website: [ modrinth, curseforge, github_release ] | |
name: ${{ matrix.website }} (${{ matrix.loader }}) | |
steps: | |
- name: Download shimmer artifact | |
uses: actions/download-artifact@v3 | |
continue-on-error: true | |
with: | |
name: Shimmer | |
- name: Checking and setting the environment | |
id: shimmer_env | |
continue-on-error: true | |
run: | | |
export loader=${{ matrix.loader }} | |
export name=$(ls ${loader}/build/libs/ | grep shadow -v | grep sources -v | awk -F.jar '{print $1}') | |
export mod_name=$(echo $name | awk -F- '{print $1}') | |
export loader_name=$(echo $name | awk -F- '{print $2}') | |
export mc_version=$(echo $name | awk -F- '{print $3}') | |
export mod_version=$(echo $name | awk -F- '{print $4}') | |
export full_version=$(echo ${mc_version}-${mod_version}) | |
echo "name=$name" >> $GITHUB_OUTPUT | |
echo "mod_name=$mod_name" >> $GITHUB_OUTPUT | |
echo "loader_name=$loader_name" >> $GITHUB_OUTPUT | |
echo "mc_version=$mc_version" >> $GITHUB_OUTPUT | |
echo "mod_version=$mod_version" >> $GITHUB_OUTPUT | |
echo "full_version=$full_version" >> $GITHUB_OUTPUT | |
rm ${loader}/build/libs/*shadow.jar | |
- name: Publish Github Release | |
uses: Kir-Antipov/[email protected] | |
continue-on-error: true | |
if: (matrix.website == 'github_release' && inputs.github-release) && ((matrix.loader == 'Forge' && inputs.forge) || (matrix.loader == 'Fabric' && inputs.fabric)) | |
with: | |
files: | | |
${{ matrix.loader }}/build/libs/!(*-@(dev|sources|javadoc)).jar | |
${{ matrix.loader }}/build/libs/*-@(dev|sources|javadocs).jar | |
name : ${{ steps.shimmer_env.outputs.name }} | |
version : ${{ steps.shimmer_env.outputs.full_version }} | |
version-type: ${{ inputs.release-type }} | |
changelog: ${{ inputs.changelog }} | |
java : Java 18 | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
github-generate-changelog: true | |
- name: Publish Modrinth Release | |
uses: Kir-Antipov/[email protected] | |
continue-on-error: true | |
if : (matrix.website == 'modrinth' && inputs.modrinth) && ((matrix.loader == 'Forge' && inputs.forge) || (matrix.loader == 'Fabric' && inputs.fabric)) | |
with: | |
files: | | |
${{ matrix.loader }}/build/libs/!(*-@(dev|sources|javadoc)).jar | |
${{ matrix.loader }}/build/libs/*-@(dev|sources|javadocs).jar | |
name: ${{ steps.shimmer_env.outputs.name }} | |
version: ${{ steps.shimmer_env.outputs.full_version }} | |
version-type: ${{ inputs.release-type }} | |
changelog: ${{ inputs.changelog }} | |
java: Java 18 | |
modrinth-id: uBKACKpl | |
modrinth-token: ${{ secrets.MODRINTH_TOKEN }} | |
- name: Publish Curseforge Release | |
uses: Kir-Antipov/[email protected] | |
continue-on-error: true | |
if: (matrix.website == 'curseforge' && inputs.curseforge) && ((matrix.loader == 'Forge' && inputs.forge) || (matrix.loader == 'Fabric' && inputs.fabric)) | |
with: | |
files: | | |
${{ matrix.loader }}/build/libs/!(*-@(dev|sources|javadoc)).jar | |
${{ matrix.loader }}/build/libs/*-@(dev|sources|javadocs).jar | |
name: ${{ steps.shimmer_env.outputs.name }} | |
version: ${{ steps.shimmer_env.outputs.full_version }} | |
version-type: ${{ inputs.release-type }} | |
changelog: ${{ inputs.changelog }} | |
java: Java 18 | |
curseforge-id: 627824 | |
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} |