Skip to content

Release Pack

Release Pack #64

name: Release Pack
on:
workflow_dispatch:
jobs:
export_pack:
name: Export Pack
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Setup Go environment
uses: actions/[email protected]
- name: Install Packwiz
run: go install github.com/packwiz/packwiz@latest
- name: Export modpack
run: |
cd packwiz
packwiz mr export
cd ..
- name: Make changelog file
run: |
cat CHANGELOG.md | awk '/^# /{count++; if(count==2) exit; next} count==1' >> latest-changelog.md
- name: Get pack version
run: |
echo "PACKVERSION=$(grep -oP '(?<=# Release )\d+\.\d+\.\d+' CHANGELOG.md | head -n 1)" >> $GITHUB_ENV
- name: Get Minecraft version
run: |
echo "MC=$(grep -E 'minecraft\s*=\s*"[0-9.]+"' packwiz/pack.toml | awk -F'"' '{print $2}')" >> $GITHUB_ENV
- uses: Kir-Antipov/[email protected]
with:
modrinth-id: KmiWHzQ4
modrinth-featured: false
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
github-tag: ${{env.PACKVERSION}}
changelog-file: latest-changelog.md
github-token: ${{ secrets.RELEASE_GITHUB_TOKEN }}
name: "${{env.PACKVERSION}} for ${{env.MC}}"
version: ${{env.PACKVERSION}}
files-primary: packwiz/Skyblocker Modpack-*.mrpack
loaders: |
fabric
game-versions: |
${{env.MC}}
- name: Discord notification
run: |
JSON_PAYLOAD='{
"content": "<@&1175530098066210816>",
"embeds": [
{
"title": "${{env.PACKVERSION}} for ${{env.MC}}",
"color": 1345667,
"fields": [
{
"name": "**Changes**",
"value": "${cat CHANGELOG.md | awk '/^# /{count++; if(count==2) exit; next} count==1' | tail -n +3 | sed 's/###//' | awk '{$1=$1};1'}"
},
{
"name": "Downloads",
"value": "[<:modrinth:900697862206287882> Modrinth](https://modrinth.com/modpack/skyblocker-modpack/version/${{env.PACKVERSION}})\n[<:github:900697885706952725> Github](https://github.com/SkyblockerMod/Skyblocker-modpack/releases/tag/${{env.PACKVERSION}})"
}
],
"author": {
"name": "Skyblocker Modpack",
"url": "https://modrinth.com/modpack/skyblocker-modpack"
},
"footer": {
"text": "A fabric Mod",
"icon_url": "https://fabricmc.net/assets/logo.png"
},
"thumbnail": {
"url": "https://hysky.de/skyblocker.png"
}
}
],
"attachments": []
}'
curl -H "Content-Type: application/json" --data-binary "$JSON_PAYLOAD" "${{ secrets.DISCORD_UPDATE_MODPACK_WEBHOOK }}"