publish #12
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 | |
env: | |
MOD_NAME: Decorative Blocks | |
CURSEFORGE_ID: 362528 | |
MODRINTH_ID: t6BIRVZn | |
on: | |
workflow_dispatch: | |
jobs: | |
call-build-workflow: | |
permissions: | |
contents: read | |
uses: "./.github/workflows/build.yml" | |
publish: | |
needs: call-build-workflow | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
strategy: | |
matrix: | |
website: [ modrinth, curseforge ] | |
loader: [ forge, fabric ] | |
name: ${{ matrix.website }} (${{ matrix.loader }}) | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download artifact | |
uses: actions/download-artifact@v3 | |
continue-on-error: true | |
with: | |
name: ${{ env.MOD_NAME }} | |
- name: Checking and setting the environment | |
continue-on-error: true | |
run: | | |
export loader=${{ matrix.loader }} | |
export name=$(ls ${loader}/build/libs/ | grep shadow -v | grep sources -v | grep javadoc -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}') | |
echo "name=$name" >> $GITHUB_ENV | |
echo "mod_name=$mod_name" >> $GITHUB_ENV | |
echo "loader_name=$loader_name" >> $GITHUB_ENV | |
echo "mc_version=$mc_version" >> $GITHUB_ENV | |
echo "mod_version=$mod_version" >> $GITHUB_ENV | |
rm ${loader}/build/libs/*shadow.jar | |
- name: Publish Modrinth Release | |
uses: Kir-Antipov/[email protected] | |
if: matrix.website == 'modrinth' | |
with: | |
modrinth-id: ${{ env.MODRINTH_ID }} | |
modrinth-token: ${{ secrets.MODRINTH_TOKEN }} | |
files: | | |
${{ matrix.loader }}/build/libs/!(*-@(dev|sources|javadoc)).jar | |
${{ matrix.loader }}/build/libs/*-@(dev|sources|javadocs).jar | |
java: Java 17 | |
name: > | |
[ | |
${{ env.loader_name }} ${{ env.mc_version }} | |
] | |
v${{ env.mod_version }} | |
version: ${{ env.mod_version }}+${{ matrix.loader }} | |
version-type: release | |
changelog-file: CHANGELOG.* | |
- name: Publish Curseforge Release | |
uses: Kir-Antipov/[email protected] | |
if: matrix.website == 'curseforge' | |
with: | |
curseforge-id: ${{ env.CURSEFORGE_ID }} | |
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} | |
files: | | |
${{ matrix.loader }}/build/libs/!(*-@(dev|sources|javadoc)).jar | |
${{ matrix.loader }}/build/libs/*-@(dev|sources|javadocs).jar | |
java: Java 17 | |
name: > | |
[ | |
${{ env.loader_name }} ${{ env.mc_version }} | |
] | |
v${{ env.mod_version }} | |
version: ${{ env.mod_version }}+${{ matrix.loader }} | |
version-type: release | |
changelog-file: CHANGELOG.* |