Some checks failed
Build & Release Pack / build (push) Failing after 1m56s
The node:20-bullseye runner image ships Python 3.9, which lacks tomllib (3.11+). Extract inline workflow validation into tools/validate_pack.py using regex-based parsing of the machine- generated packwiz TOML subset, and call it from the workflow.
75 lines
No EOL
2.4 KiB
YAML
75 lines
No EOL
2.4 KiB
YAML
name: Build & Release Pack
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
tags: ['v*']
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: docker
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.22'
|
|
|
|
- name: Install packwiz
|
|
run: go install github.com/packwiz/packwiz@latest
|
|
|
|
- name: Add packwiz to PATH
|
|
run: echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"
|
|
|
|
- name: Refresh index
|
|
working-directory: client_pack
|
|
run: packwiz refresh
|
|
|
|
- name: Integrity check
|
|
working-directory: client_pack
|
|
run: python3 ../tools/validate_pack.py . integrity
|
|
|
|
- name: Sanity grep download URLs
|
|
working-directory: client_pack
|
|
run: python3 ../tools/validate_pack.py . sanity
|
|
|
|
- name: Export Modrinth pack
|
|
working-directory: client_pack
|
|
run: packwiz modrinth export -o ../SciCraft-Modrinth.mrpack --restrictDomains=false
|
|
|
|
- name: Export CurseForge pack
|
|
working-directory: client_pack
|
|
run: packwiz curseforge export -o ../SciCraft-CurseForge.zip
|
|
|
|
- name: Validate CurseForge pack completeness
|
|
working-directory: client_pack
|
|
run: python3 ../tools/validate_pack.py . cf ../SciCraft-CurseForge.zip
|
|
|
|
- name: Upload pack artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: scicraft-pack
|
|
path: |
|
|
SciCraft-Modrinth.mrpack
|
|
SciCraft-CurseForge.zip
|
|
|
|
- name: Release
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
run: |
|
|
set -e
|
|
TAG="${GITHUB_REF_NAME}"
|
|
API="https://git.mithraic.cloud/api/v1/repos/ad3laid3/SciCraft/releases"
|
|
AUTH="Authorization: token ${{ secrets.GITHUB_TOKEN }}"
|
|
RELEASE_JSON=$(curl -sS -X POST "$API" \
|
|
-H "$AUTH" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"tag_name\":\"$TAG\",\"name\":\"SCICRAFT $TAG\",\"body\":\"Automated release built from Gitea Actions.\"}")
|
|
RELEASE_ID=$(printf '%s' "$RELEASE_JSON" | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])")
|
|
for f in SciCraft-Modrinth.mrpack SciCraft-CurseForge.zip; do
|
|
curl -sS -X POST "$API/$RELEASE_ID/assets?name=$(basename "$f")" \
|
|
-H "$AUTH" \
|
|
-F "attachment=@$f"
|
|
echo "Uploaded $f"
|
|
done |