Build Multiplatform #7 #7
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 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 }} | |
steps: | |
- name: Checkout with fetch depth 2 | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- 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 | |
latest_tag=$(git describe --tags --abbrev=0) | |
echo "tag=$latest_tag" >> $GITHUB_OUTPUT | |
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 | |
- name: Diff | |
run: | | |
latest_tag=$(git describe --tags --abbrev=0) | |
latest_tagged_commit=$(git rev-list -n 1 --pretty=format:"%h" $latest_tag | sed -n 2p) | |
if [ "$latest_tag" = ${{ steps.info.outputs.tag }} ]; then | |
latest_tag=$(git describe --tags --abbrev=0 $(git describe --tags --abbrev=0)^) | |
latest_tagged_commit=$(git rev-list -n 1 --pretty=format:"%h" $latest_tag | sed -n 2p) | |
fi | |
echo "latest commit: $latest_commit" | |
echo "latest tagged commit: $latest_tagged_commit" | |
git show $latest_tagged_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 | |
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/ |