ci: release to other modding platforms

This commit is contained in:
darksaid98 committed 2024-12-12 07:01:46 +01:00
1 parent a43e941dd7
commit a90510df58
3 files changed
+160 -1

No files matched your search

+46
View File
@@ -0,0 +1,46 @@
name: 'Read Metadata'
description: 'Reads metadata from modpack config and outputs it.'
inputs:
working-directory:
description: 'Path to the modpack directory'
required: false
default: '.'
pack-file:
description: 'Path to the pack config file'
required: false
default: 'pack.toml'
outputs:
mod-loader:
description: 'Detected mod loader'
value: ${{ steps.read.outputs.mod-loader }}
minecraft-version:
description: 'Detected minecraft version'
value: ${{ steps.read.outputs.minecraft-version }}
runs:
using: 'composite'
steps:
# Checkout repository
- name: Checkout Repository
uses: actions/checkout@v4
# Read metadata in pack.toml and output to workflow
- name: Read Metadata
id: read
shell: bash
working-directory: ${{ inputs.working-directory }}
run: |
loaders=("fabric" "forge" "quilt" "neoforge", "rift")
for loader in "${loaders[@]}"; do
if [[ $(<"pack.toml") == *"$loader ="* ]]; then
MODPACK_MODLOADER="$loader" && break
fi
done
[[ -z "$MODPACK_MODLOADER" ]] && { echo "::error file=pack.toml::No valid modpack loader found in pack.toml" && exit 1; }
MODPACK_MINECRAFT_VERSION=$(grep -oP 'minecraft = "\K[^"]+' "pack.toml")
echo "mod-loader=$MODPACK_MODLOADER" >> $GITHUB_ENV
echo "minecraft-version=$MODPACK_MINECRAFT_VERSION" >> $GITHUB_ENV
+91
View File
@@ -0,0 +1,91 @@
name: 'Publish Release On External Platforms'
description: 'Publish a release to specific modding platforms.'
inputs:
modrinth:
description: "Whether to upload to Modrinth"
required: true
curseforge:
description: "Whether to upload to CurseForge"
required: true
working-directory:
description: 'Path to the modpack directory'
required: false
default: '.'
version:
description: 'Modpack version'
required: true
default: '1.0.0'
mod-loader:
description: "Detected mod loader"
required: true
default: 'fabric'
minecraft-version:
description: "Detected minecraft version"
required: true
changelog:
description: "The changelog as markdown text"
required: true
MODRINTH_TOKEN:
required: false
description: "Token used for authenticating with Modrinth API"
MODRINTH_ID:
required: false
description: "Identifier used for authenticating with Modrinth API"
CURSEFORGE_TOKEN:
required: false
description: "Token used for authenticating with CurseForge API"
CURSEFORGE_ID:
required: false
description: "Identifier used for authenticating with CurseForge API"
runs:
using: 'composite'
steps:
# Checkout repository
- name: Checkout Repository
uses: actions/checkout@v4
# Download release files
- name: Download Release
uses: robinraju/[email protected]
with:
fileName: "*"
tag: ${{ inputs.version }}
tarBall: false
zipBall: false
# Create a markdown file of the release description
- name: Pipe Release Description to File
shell: bash
run: echo "${{ inputs.changelog }}" > CHANGELOG.release.md
# Publish release to Modrinth
- name: Publish to Modrinth
if: inputs.modrinth == 'true'
uses: Kir-Antipov/[email protected]
with:
modrinth-id: ${{ inputs.MODRINTH_ID }}
modrinth-token: ${{ inputs.MODRINTH_TOKEN }}
loaders: ${{ inputs.mod-loader }}
game-versions: ${{ inputs.minecraft-version }}
files: "*.mrpack"
version: ${{ inputs.version }}
version-type: release
changelog-file: CHANGELOG.release.*
# Publish release to CurseForge
- name: Publish to CurseForge
if: inputs.curseforge == 'true'
uses: Kir-Antipov/[email protected]
with:
curseforge-id: ${{ inputs.CURSEFORGE_ID }}
curseforge-token: ${{ inputs.CURSEFORGE_TOKEN }}
loaders: ${{ inputs.mod-loader }}
game-versions: ${{ inputs.minecraft-version }}
files: "*.zip"
version: ${{ inputs.version }}
version-type: release
changelog-file: CHANGELOG.release.*