Skip to content

Build Multiplatform #14 #14

Build Multiplatform #14

Build Multiplatform #14 #14

name: Build Multiplatform
run-name: "Build Multiplatform #${{ github.run_number }}"
on:
push:
tags:
- 'v*'
branches:
- main
jobs:
modpack-info:
name: Modpack Info
runs-on: ubuntu-latest
outputs:
projectname: ${{ steps.info.outputs.projectname }}
projectsuffix: ${{ steps.info.outputs.projectsuffix }}
tag: ${{ steps.info.outputs.tag }}
diff: ${{ steps.info.outputs.diff }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get modpack info
id: info
shell: bash
run: |
set +e
# -- CHECK LOCKFILE --
if [ ! -f pakku-lock.json ]; then
echo "::error::Could not find pakku-lock.json" && exit 1
fi
manifestjson=`cat pakku-lock.json`
# -- PROJECT NAME --
projectname=`echo $(jq -r '.name' <<< "$manifestjson")`
echo "projectname=$projectname" >> $GITHUB_OUTPUT
# -- TAG --
latest_tag=$(git describe --tags --abbrev=0)
echo "tag=$latest_tag" >> $GITHUB_OUTPUT
# -- PROJECT SUFFIX --
if [[ ${{ startsWith(github.ref, 'refs/tags/v') }} == true ]]; then
echo "projectsuffix=$latest_tag" >> $GITHUB_OUTPUT
else
echo "projectsuffix=build.${{ github.run_number }}" >> $GITHUB_OUTPUT
fi
# -- DIFF --
previous_commit=$(git log -n 1 --skip 1 --pretty=format:"%h" -- $manifest)
git show $previous_commit:./pakku-lock.json > ./pakku-lock-prev.json
curl https://github.com/juraj-hrivnak/pakku/releases/latest/download/pakku.jar -o pakku.jar -L -J
java -jar ./pakku.jar diff ./pakku-lock-prev.json ./pakku-lock.json --markdown PROJECTS_DIFF.md
# -- OUTPUT DIFF --
diff_text=$(cat PROJECTS_DIFF.md)
echo "diff=$diff_text" >> $GITHUB_OUTPUT
diff_text >> $GITHUB_STEP_SUMMARY
- name: Send Discord message
uses: "hugoalh/send-discord-webhook-ghaction@v6.0.1"
if: ${{ steps.info.outputs.diff }} != ''
with:
key: ${{ secrets.DISCORD_WEBHOOK }}
content: ${{ steps.info.outputs.diff }}
username: "UnderBot"
avatar_url: "https://media.forgecdn.net/avatars/828/211/638215807562150866.png"
build-modpack:
name: Build Modpack
runs-on: ubuntu-latest
needs: [modpack-info]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Export modpack
run: |
curl https://github.com/juraj-hrivnak/pakku/releases/latest/download/pakku.jar -o pakku.jar -L -J
java -jar ./pakku.jar export
mkdir build
mv ${{ needs.modpack-info.outputs.projectname }}.zip build/${{ needs.modpack-info.outputs.projectname }}-${{ needs.modpack-info.outputs.projectsuffix }}.zip
mv ${{ needs.modpack-info.outputs.projectname }}.mrpack build/${{ needs.modpack-info.outputs.projectname }}-${{ needs.modpack-info.outputs.projectsuffix }}.mrpack
- name: Upload modpacks
uses: actions/upload-artifact@v4
with:
name: modpacks
path: build/