Skip to content

Carpet-AMS-Addition v2.14.2 #100

Carpet-AMS-Addition v2.14.2

Carpet-AMS-Addition v2.14.2 #100

Workflow file for this run

name: Release
on:
release:
types:
- published
workflow_dispatch:
inputs:
target_subproject:
description: The subproject name of the specified Minecraft version to be released.
type: string
required: false
default: ''
target_release_tag:
description: The tag of the release you want to append the artifact to
type: string
required: true
jobs:
show_action_parameters:
runs-on: ubuntu-latest
steps:
- name: Show action parameters
run: |
cat <<EOF > $GITHUB_STEP_SUMMARY
## Action Parameters
- target_subproject: `${{ github.event.inputs.target_subproject }}`
- target_release_tag: `${{ github.event.inputs.target_release_tag }}`
EOF
matrix_prep:
uses: ./.github/workflows/matrix_prep.yml
with:
target_subproject: ${{ github.event.inputs.target_subproject }}
build:
uses: ./.github/workflows/build.yml
with:
target_subproject: ${{ github.event.inputs.target_subproject }}
release: true
release:
needs:
- matrix_prep
- build
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.matrix_prep.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: build-artifacts
path: build-artifacts
- name: Get github release information
if: ${{ github.event_name == 'workflow_dispatch' }}
id: get_release
uses: cardinalby/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
with:
tag: ${{ github.event.inputs.target_release_tag }}
- name: Generate publish related information
id: release_info
run: |
if [ $GITHUB_EVENT_NAME == 'release' ]
then
echo "tag_name=" >> $GITHUB_OUTPUT # leave an empty value here so softprops/action-gh-release will use the default value
elif [ $GITHUB_EVENT_NAME == 'workflow_dispatch' ]
then
echo "tag_name=${{ github.event.inputs.target_release_tag }}" >> $GITHUB_OUTPUT
else
echo Unknown github event name $GITHUB_EVENT_NAME
exit 1
fi
- name: Read common properties
id: properties_g
uses: christian-draeger/[email protected]
with:
path: gradle.properties
properties: 'mod_name mod_version'
- name: Read version-specific properties
id: properties_v
uses: christian-draeger/[email protected]
with:
path: ${{ format('versions/{0}/gradle.properties', matrix.subproject_dir) }}
properties: 'minecraft_version game_versions'
- name: Fix game version
id: game_versions
run: |
# Fixed \n in game_versions isn't parsed by christian-draeger/read-properties as a line separator
echo 'value<<EOF' >> $GITHUB_OUTPUT
echo -e "${{ steps.properties_v.outputs.game_versions }}" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Publish Minecraft Mods
uses: Kir-Antipov/[email protected]
with:
modrinth-id: q4fx1eTg
modrinth-token: ${{ secrets.MODRINTH_API_TOKEN }}
curseforge-id: _INSERT_CURSEFORGE_MOD_ID_HERE_
curseforge-token: ${{ secrets.CF_API_TOKEN }}
github-tag: ${{ steps.release_info.outputs.tag_name }}
github-token: ${{ secrets.GITHUB_TOKEN }}
files-primary: ${{ format('build-artifacts/{0}/build/libs/!(*-@(dev|sources)).jar', matrix.subproject_dir) }}
files-secondary: ''
name: ${{ format('{0} v{1} for mc{2}', steps.properties_g.outputs.mod_name, steps.properties_g.outputs.mod_version, steps.properties_v.outputs.minecraft_version) }}
version: ${{ format('mc{0}-v{1}', steps.properties_v.outputs.minecraft_version, steps.properties_g.outputs.mod_version) }}
version-type: release
changelog: ${{ format('{0}{1}', github.event.release.body, steps.get_release.outputs.body) }} # one of them should be an empty string (null)
loaders: fabric
game-versions: ${{ steps.game_versions.outputs.value }}
version-resolver: exact
retry-attempts: 3
retry-delay: 10000