Add automated release actions.

This commit is contained in:
themodrnhakr 2026-03-06 18:06:41 -06:00
parent ad41b86f53
commit 88c9135f40

View File

@ -0,0 +1,52 @@
name: Multi-Pack Release
on:
push:
tags:
- "smp/v*"
- "creative/v*"
- "client/v*"
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Identify Pack
id: vars
run: |
TAG=${GITHUB_REF#refs/tags/}
# Extracts 'smp' from 'smp/v1.0.0'
PACK_NAME=${TAG%/*}
echo "pack_name=$PACK_NAME" >> $GITHUB_OUTPUT
# Determine the directory path based on the prefix
if [ "$PACK_NAME" = "smp" ]; then
echo "path=server/smp" >> $GITHUB_OUTPUT
elif [ "$PACK_NAME" = "creative" ]; then
echo "path=server/creative" >> $GITHUB_OUTPUT
else
echo "path=client" >> $GITHUB_OUTPUT
fi
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: "${{ steps.vars.outputs.pack_name }} ${{ github.ref_name }}"
body: "Packwiz update for ${{ steps.vars.outputs.pack_name }}."
- name: Upload pack.toml
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
# Points to the specific directory's pack.toml
asset_path: ./${{ steps.vars.outputs.path }}/pack.toml
asset_name: pack.toml
asset_content_type: text/x-toml