Skip to content

Commit

Permalink
Update build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Xikaro committed Dec 22, 2024
1 parent 40beff1 commit 383c1cd
Showing 1 changed file with 29 additions and 22 deletions.
51 changes: 29 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
else
echo "✔️ pakku.json"
fi
- name: 📈 Get latest tag
id: latest_tag
shell: bash
Expand All @@ -69,14 +69,17 @@ jobs:
id: check_pakku_lock_prev
shell: bash
run: |
if ! git ls-tree -r ${{ steps.latest_tag.outputs.tag }} -- ./pakku-lock.json &> /dev/null; then
echo "❌ File pakku-lock.json not found in previous tag" && exit 1
else
if git cat-file -e ${{ steps.latest_tag.outputs.tag }}:./pakku-lock.json 2>/dev/null; then
echo "✔️ File pakku-lock.json found in previous tag"
echo "file_found=true" >> $GITHUB_OUTPUT
else
echo "❌ File pakku-lock.json not found in previous tag"
echo "file_found=false" >> $GITHUB_OUTPUT
fi
- name: 📁 Copy pakku-lock.json from previous tag
id: copy_pakku_lock_prev
- name: 📁 Check and copy pakku-lock.json from previous tag
id: check_copy_lock
if: steps.check_pakku_lock_prev.outputs.file_found == 'true'
shell: bash
run: |
git show tags/${{ steps.latest_tag.outputs.tag }}:./pakku-lock.json > ./pakku-lock-prev.json
Expand All @@ -85,16 +88,19 @@ jobs:
else
echo "❌ Error: File pakku-lock-prev.json is empty or not created" && exit 1
fi
fi
- name: 📦 Download pakku.jar
id: download_pakku
if: steps.check_pakku_lock_prev.outputs.file_found == 'true'
shell: bash
run: |
curl https://github.com/juraj-hrivnak/pakku/releases/latest/download/pakku.jar -o pakku.jar -L -J
echo "✔️ Downloaded pakku.jar "
- name: 🔄 Run pakku diff
id: pakku_diff
if: steps.check_pakku_lock_prev.outputs.file_found == 'true'
shell: bash
run: |
java -jar pakku.jar diff -v --markdown PROJECTS_DIFF.md ./pakku-lock-prev.json ./pakku-lock.json
Expand All @@ -106,6 +112,7 @@ jobs:
- name: 📝 Read PROJECTS_DIFF.md to variable
id: read_diff
if: steps.check_pakku_lock_prev.outputs.file_found == 'true'
shell: bash
run: |
echo "📝 Reading PROJECTS_DIFF.md to variable..."
Expand Down Expand Up @@ -145,8 +152,8 @@ jobs:

- name: 📈 Upload Diff
id: upload_diff
if: ${{ steps.read_diff.outputs.diff != '' }}
uses: actions/upload-artifact@v4.4.3
if: ${{ steps.read_diff.outputs.diff != '' }} && steps.check_pakku_lock_prev.outputs.file_found == 'true'
uses: actions/upload-artifact@v4.5.0
with:
name: Mods-diff
path: PROJECTS_DIFF.md
Expand All @@ -158,16 +165,16 @@ jobs:
tag: ${{ steps.project_version.outputs.value }}

- name: 📝 Generate Github Summary
run: |
echo "📃 **Name**: ${{ steps.project_name.outputs.value }}" >> $GITHUB_STEP_SUMMARY
echo "📃 **Release**: ${{ steps.project_version.outputs.value }}" >> $GITHUB_STEP_SUMMARY
echo "📃 **Release Type**: ${{ env.RELEASE_TYPE }}" >> $GITHUB_STEP_SUMMARY
echo "📃 **Game Version**: ${{ env.MINECRAFT_VERSION }}" >> $GITHUB_STEP_SUMMARY
echo "${{ steps.changelog.outputs.description }}" >> $GITHUB_STEP_SUMMARY
if [ -n "${{ steps.read_diff.outputs.diff != '' }}" ]; then
echo "${{ steps.read_diff.outputs.diff }}" >> $GITHUB_STEP_SUMMARY
fi
uses: WcAServices/[email protected]
with:
template: |
📃 **Name**: ${{ steps.project_name.outputs.value }}
📃 **Release**: ${{ steps.project_version.outputs.value }}
📃 **Release Type**: ${{ env.RELEASE_TYPE }}
📃 **Game Version**: ${{ env.MINECRAFT_VERSION }}
${{ steps.changelog.outputs.description }}
${{ steps.read_diff.outputs.diff }}

build-modpack:
Expand Down Expand Up @@ -210,7 +217,7 @@ jobs:
mv *.zip $(basename -s .zip *.zip)-curseforge.zip
- name: 🚀 Upload artifact CurseForge
uses: actions/upload-artifact@v4.4.3
uses: actions/upload-artifact@v4.5.0
with:
name: ${{ needs.info.outputs.project_full_name }}-curseforge
path: ./build/curseforge/${{ needs.info.outputs.project_full_name }}-curseforge.zip
Expand All @@ -222,7 +229,7 @@ jobs:
mv *.mrpack $(basename -s .mrpack *.mrpack)-modrinth.mrpack
- name: 🚀 Upload artifact modrinth
uses: actions/upload-artifact@v4.4.3
uses: actions/upload-artifact@v4.5.0
with:
name: ${{ needs.info.outputs.project_full_name }}-modrinth
path: ./build/modrinth/${{ needs.info.outputs.project_full_name }}-modrinth.mrpack
Expand Down Expand Up @@ -269,7 +276,7 @@ jobs:
mv *.zip $(basename -s .zip *.zip)-serverpack.zip
- name: 🚀 Upload artifact server
uses: actions/upload-artifact@v4.4.3
uses: actions/upload-artifact@v4.5.0
with:
name: ${{ needs.info.outputs.project_full_name }}-serverpack
path: ./build/serverpack/${{ needs.info.outputs.project_full_name }}-serverpack.zip
Expand Down Expand Up @@ -323,7 +330,7 @@ jobs:
zip -r ${{ needs.info.outputs.project_full_name }}-multimc.zip icon.png mmc-pack.json instance.cfg .minecraft/ flame/
- name: 🚀 Upload zip multimc
uses: actions/upload-artifact@v4.4.3
uses: actions/upload-artifact@v4.5.0
with:
name: ${{ needs.info.outputs.project_full_name }}-multimc
path: .pakku/multimc-overrides/${{ needs.info.outputs.project_full_name }}-multimc.zip
Expand Down

0 comments on commit 383c1cd

Please sign in to comment.