Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 9 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
name: Datapack Multi-Version Build

on:
push:
branches: [main]
pull_request:

env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
include:
Expand All @@ -31,9 +32,8 @@ jobs:
- label: "full"
pack_format: 101
overlays: ""

steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7

# 🔒 Repo lock — prevent running from wrong fork
- name: Repo lock
Expand Down Expand Up @@ -63,14 +63,16 @@ jobs:
--exclude='README.md' \
--exclude='version.json' \
--exclude='dependencies.json' \
--exclude='build' \
--exclude='.devcontainer' \
--exclude='.gradle' \
./ build/

# 📂 Copy overlays
- name: Copy target overlays
run: |
ALL_OVERLAYS="1_20_3 1_20_5 _pre_1_21_4 compat_1_21_4 1_21_5 1_21_6 26_1 26_2"
TARGET="${{ matrix.overlays }}"

if [ -z "$TARGET" ]; then
# Full build: copy all overlay directories
for d in $ALL_OVERLAYS; do
Expand All @@ -93,13 +95,11 @@ jobs:
LABEL="${{ matrix.label }}"
FORMAT="${{ matrix.pack_format }}"
OVERLAYS="${{ matrix.overlays }}"

# Convert overlay list to jq array (may be empty for full build)
JQ_ARRAY="[]"
for ov in $OVERLAYS; do
JQ_ARRAY=$(echo "$JQ_ARRAY" | jq --arg d "$ov" '. + [$d]')
done

jq \
--argjson fmt "$FORMAT" \
--argjson keep "$JQ_ARRAY" \
Expand Down Expand Up @@ -130,7 +130,7 @@ jobs:
echo "Archive size: $(du -sh ../dataLib-${{ matrix.label }}.zip | cut -f1)"

# 🚀 Upload as artifact
- uses: actions/upload-artifact@v6
- uses: actions/upload-artifact@v7
with:
name: dataLib-${{ matrix.label }}
path: dataLib-${{ matrix.label }}.zip
Expand All @@ -144,12 +144,10 @@ jobs:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'

permissions:
contents: write

steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7

# 🔒 Repo lock
- name: Repo lock
Expand All @@ -169,7 +167,6 @@ jobs:
- name: Read version
id: ver
run: |
# Extract version like "v6.0.0" from the description array in pack.mcmeta
VERSION=$(jq -r '
.pack.description |
if type == "array" then
Expand All @@ -179,7 +176,6 @@ jobs:
select(test("^\\s*\\|\\s*v[0-9]")) |
gsub("^\\s*\\|\\s*"; "") | ltrimstr(" ")
' pack.mcmeta | head -1)
# Fallback: if description is a plain string, extract directly
if [ -z "$VERSION" ]; then
VERSION=$(jq -r '.pack.description' pack.mcmeta | grep -oP 'v[\d.]+' | head -1)
fi
Expand All @@ -192,11 +188,8 @@ jobs:
run: |
TAG="${{ steps.ver.outputs.version }}"
ZIP="dist/dataLib-full.zip"

# Delete existing tag if it exists, otherwise continue
gh release delete "$TAG" --yes 2>/dev/null || true
git push origin ":refs/tags/$TAG" 2>/dev/null || true

gh release create "$TAG" \
--title "dataLib $TAG" \
--notes "**Full multi-version datapack build** (pack_format 101, all overlays included)." \
Expand Down