Files
saturnclient/.gitea/workflows/release.yml
T
selimaj-devandclaude 6ee8b64a38 Add release workflow that builds every version and attaches the jars
On a published release, build all versions with buildAll using the tag
as the mod version, and upload build/allJars/*.jar to the release.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-25 16:33:42 +02:00

59 lines
1.6 KiB
YAML

name: Release
# Publishing a release builds every Minecraft version from the release's tag
# and attaches the mod jars to it. The tag is the mod version (e.g.
# 0.1.1-beta); a leading "v" is dropped.
on:
release:
types: [published]
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Set up Java 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: gradle
- name: Build all versions
env:
TAG: ${{ github.event.release.tag_name }}
run: |
VERSION="${TAG#v}"
echo "Building Saturn Client $VERSION"
chmod +x gradlew
# buildAll remaps every versions/* project in parallel into build/allJars.
./gradlew buildAll -Pmod_version="$VERSION" --no-daemon --stacktrace
- name: Upload jars to the release
env:
TOKEN: ${{ secrets.GITEA_TOKEN }}
ASSETS_URL: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases/${{ github.event.release.id }}/assets
run: |
shopt -s nullglob
jars=(build/allJars/*.jar)
if [ ${#jars[@]} -eq 0 ]; then
echo "No jars found in build/allJars" >&2
exit 1
fi
for jar in "${jars[@]}"; do
echo "Uploading $(basename "$jar")"
curl --fail-with-body -sS -X POST \
-H "Authorization: token $TOKEN" \
-F "attachment=@$jar" \
"$ASSETS_URL"
echo
done