Some checks failed
Build and Release / build (0.106.1+1.21.2, 1.21.2, 1.21.2+build.1) (pull_request) Failing after 5m55s
Build and Release / build (0.114.1+1.21.3, 1.21.3, 1.21.3+build.2) (pull_request) Failing after 6m1s
Build and Release / build (0.116.10+1.21.1, 1.21.1, 1.21.1+build.3) (pull_request) Failing after 3m22s
Build and Release / build (0.119.4+1.21.4, 1.21.4, 1.21.4+build.8) (pull_request) Failing after 3m32s
Build and Release / build (0.128.2+1.21.5, 1.21.5, 1.21.5+build.1) (pull_request) Failing after 2m20s
Build and Release / build (0.128.2+1.21.6, 1.21.6, 1.21.6+build.1) (pull_request) Failing after 2m16s
Build and Release / build (0.134.1+1.21.9, 1.21.9, 1.21.9+build.1) (pull_request) Failing after 1m38s
Build and Release / build (0.129.0+1.21.7, 1.21.7, 1.21.7+build.8) (pull_request) Failing after 2m18s
Build and Release / build (0.138.4+1.21.10, 1.21.10, 1.21.10+build.3) (pull_request) Failing after 1m24s
Build and Release / build (0.136.1+1.21.8, 1.21.8, 1.21.8+build.1) (pull_request) Failing after 1m52s
Build and Release / build (0.141.3+1.21.11, 1.21.11, 1.21.11+build.4) (pull_request) Failing after 1m15s
Build and Release / publish (pull_request) Has been skipped
178 lines
5.7 KiB
YAML
178 lines
5.7 KiB
YAML
name: Build and Release
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- "v*"
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: gradle:8.14.5-jdk21
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- minecraft_version: "1.21.1"
|
|
yarn_mappings: "1.21.1+build.3"
|
|
fabric_version: "0.116.10+1.21.1"
|
|
- minecraft_version: "1.21.2"
|
|
yarn_mappings: "1.21.2+build.1"
|
|
fabric_version: "0.106.1+1.21.2"
|
|
- minecraft_version: "1.21.3"
|
|
yarn_mappings: "1.21.3+build.2"
|
|
fabric_version: "0.114.1+1.21.3"
|
|
- minecraft_version: "1.21.4"
|
|
yarn_mappings: "1.21.4+build.8"
|
|
fabric_version: "0.119.4+1.21.4"
|
|
- minecraft_version: "1.21.5"
|
|
yarn_mappings: "1.21.5+build.1"
|
|
fabric_version: "0.128.2+1.21.5"
|
|
- minecraft_version: "1.21.6"
|
|
yarn_mappings: "1.21.6+build.1"
|
|
fabric_version: "0.128.2+1.21.6"
|
|
- minecraft_version: "1.21.7"
|
|
yarn_mappings: "1.21.7+build.8"
|
|
fabric_version: "0.129.0+1.21.7"
|
|
- minecraft_version: "1.21.8"
|
|
yarn_mappings: "1.21.8+build.1"
|
|
fabric_version: "0.136.1+1.21.8"
|
|
- minecraft_version: "1.21.9"
|
|
yarn_mappings: "1.21.9+build.1"
|
|
fabric_version: "0.134.1+1.21.9"
|
|
- minecraft_version: "1.21.10"
|
|
yarn_mappings: "1.21.10+build.3"
|
|
fabric_version: "0.138.4+1.21.10"
|
|
- minecraft_version: "1.21.11"
|
|
yarn_mappings: "1.21.11+build.4"
|
|
fabric_version: "0.141.3+1.21.11"
|
|
env:
|
|
GITEA_TOKEN: ${{ github.token }}
|
|
GITEA_API_URL: ${{ github.server_url }}/api/v1
|
|
GITEA_REPO_URL: ${{ github.server_url }}/${{ github.repository }}.git
|
|
steps:
|
|
- name: Prepare source
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
if [ ! -f build.gradle ]; then
|
|
git -c http.extraHeader="Authorization: token ${GITEA_TOKEN}" \
|
|
clone --depth 1 "${GITEA_REPO_URL}" .
|
|
fi
|
|
|
|
- name: Build
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
echo "Building Minecraft ${{ matrix.minecraft_version }}"
|
|
gradle --no-daemon clean build \
|
|
-Pminecraft_version="${{ matrix.minecraft_version }}" \
|
|
-Pyarn_mappings="${{ matrix.yarn_mappings }}" \
|
|
-Pfabric_version="${{ matrix.fabric_version }}"
|
|
|
|
mkdir -p release-artifacts
|
|
|
|
jar_path=""
|
|
shopt -s nullglob
|
|
for candidate in build/libs/*.jar; do
|
|
case "$(basename "${candidate}")" in
|
|
*-sources.jar|*-dev.jar)
|
|
continue
|
|
;;
|
|
esac
|
|
|
|
jar_path="${candidate}"
|
|
break
|
|
done
|
|
|
|
if [ -z "${jar_path}" ]; then
|
|
echo "No build jar found for Minecraft ${{ matrix.minecraft_version }}"
|
|
exit 1
|
|
fi
|
|
|
|
cp "${jar_path}" "release-artifacts/sign-leak-shield-${{ matrix.minecraft_version }}.jar"
|
|
|
|
- name: Upload build artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: sign-leak-shield-${{ matrix.minecraft_version }}
|
|
path: release-artifacts/sign-leak-shield-${{ matrix.minecraft_version }}.jar
|
|
if-no-files-found: error
|
|
retention-days: 7
|
|
|
|
publish:
|
|
needs: build
|
|
if: github.event_name != 'pull_request'
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: gradle:8.14.5-jdk21
|
|
env:
|
|
GITEA_TOKEN: ${{ github.token }}
|
|
GITEA_API_URL: ${{ github.server_url }}/api/v1
|
|
GITEA_REPO: ${{ github.repository }}
|
|
GITEA_REF_NAME: ${{ github.ref_name }}
|
|
GITEA_SHA: ${{ github.sha }}
|
|
steps:
|
|
- name: Download build artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: versioned-jars
|
|
pattern: sign-leak-shield-*
|
|
merge-multiple: true
|
|
|
|
- name: Publish Gitea release
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
shopt -s nullglob
|
|
jar_paths=(versioned-jars/*.jar)
|
|
if [ "${#jar_paths[@]}" -eq 0 ]; then
|
|
echo "No build artifacts were downloaded"
|
|
exit 1
|
|
fi
|
|
|
|
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
|
|
release_tag="${GITEA_REF_NAME}"
|
|
release_name="${GITEA_REF_NAME}"
|
|
prerelease=false
|
|
else
|
|
release_tag="build-${GITEA_SHA:0:7}"
|
|
release_name="build-${GITEA_SHA:0:7}"
|
|
prerelease=false
|
|
fi
|
|
|
|
release_payload="$(printf '{"tag_name":"%s","name":"%s","body":"Automated parallel build for Minecraft 1.21.1 through 1.21.11.","draft":false,"prerelease":%s}' \
|
|
"${release_tag}" "${release_name}" "${prerelease}")"
|
|
|
|
release_json="$(curl -fsS \
|
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
-H "Content-Type: application/json" \
|
|
-d "${release_payload}" \
|
|
"${GITEA_API_URL}/repos/${GITEA_REPO}/releases")"
|
|
|
|
release_id="$(printf '%s' "${release_json}" | sed -n 's/.*"id":[[:space:]]*\([0-9][0-9]*\).*/\1/p' | head -n 1)"
|
|
if [ -z "${release_id}" ]; then
|
|
echo "Failed to parse release ID from response:"
|
|
printf '%s\n' "${release_json}"
|
|
exit 1
|
|
fi
|
|
|
|
for jar_path in "${jar_paths[@]}"; do
|
|
curl -fsS \
|
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
-H "Content-Type: multipart/form-data" \
|
|
-F "attachment=@${jar_path}" \
|
|
"${GITEA_API_URL}/repos/${GITEA_REPO}/releases/${release_id}/assets?name=$(basename "${jar_path}")"
|
|
done
|