Build #1 #1
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: Build Multiplatform | |
run-name: "Build #${{ 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.version.outputs.tag }} | |
steps: | |
- name: Checkout with fetch depth 2 | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Get tag | |
id: version | |
uses: "WyriHaximus/github-action-get-previous-tag@v1" | |
with: | |
fallback: tag_not_found | |
- name: Get modpack info | |
id: info | |
shell: bash | |
run: | | |
set +e | |
if [ ! -f pakku-lock.json ]; then | |
echo "::error::Could not find pakku-lock.json" && exit 1 | |
fi | |
manifestjson=`cat pakku-lock.json` | |
projectname=`echo $(jq -r '.name' <<< "$manifestjson")` | |
echo "projectname=$projectname" >> $GITHUB_OUTPUT | |
if [[ ${{ startsWith(github.ref, 'refs/tags/v') }} == true ]]; then | |
echo "projectsuffix=${{ steps.version.outputs.tag }}" >> $GITHUB_OUTPUT | |
else | |
echo "projectsuffix=build.${{ github.run_number }}" >> $GITHUB_OUTPUT | |
fi | |
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/ |