Skip to content

1.21.2 release

1.21.2 release #871

Workflow file for this run

name: "build"
on:
push:
branches: "**"
tags-ignore: ["**"]
pull_request:
concurrency:
group: "${{ github.workflow }}-${{ github.event.number || github.ref }}"
cancel-in-progress: true
jobs:
build:
# Only run on PRs if the source branch is on someone else's repo
if: "${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}"
strategy:
matrix:
os: ["ubuntu-latest"] # disable windows cuz it fails ONLY in GH actions and not locally
# os: ["ubuntu-latest", "windows-latest"]
runs-on: "${{ matrix.os }}"
steps:
- name: "setup env"
id: "setup"
uses: "KyoriPowered/.github/.github/actions/setup-java-env@trunk"
with:
runtime_version: 21
publishing_branch_regex: '(?:(?:(?:mc\/)?(\d+(?:\.\d+)*(?:\.x)?)))'
gradle_warning_mode: "all"
- name: "prime gradle build"
run: "./gradlew --no-daemon generateTemplates generateTestmodTemplates --stacktrace" # Bonk loom
- name: "run gradle build"
run: "./gradlew build --stacktrace"
- name: "archive test results"
if: "${{ always() }}"
uses: "actions/[email protected]"
with:
name: "${{ runner.os }}-test-results"
path: |
build/reports/
*/build/reports/
- name: "determine status"
shell: "bash"
run: |
VERSION="$(./gradlew properties | awk '/^version:/ { print $2; }')"
if [ "$(echo $VERSION | grep '\-SNAPSHOT')" ]; then
echo "STATUS=snapshot" >> $GITHUB_ENV
else
echo "STATUS=release" >> $GITHUB_ENV
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: "Cache test run data"
uses: "actions/[email protected]"
with:
path: |
testserver/libraries
testserver/versions
testserver/.fabric/server
testserver/world
key: testserver-${{ runner.os }}-${{ github.run_id }}
restore-keys: testserver-${{ runner.os }}-
- name: "Execute production test run"
shell: bash
run: |
echo "::group::Environment Setup"
pip install yq
mkdir -p testserver/mods
MC_VERSION="$(tomlq -r '.versions.minecraft' gradle/libs.versions.toml)"
LOADER_VERSION="$(tomlq -r '.versions.fabricLoader' gradle/libs.versions.toml)"
API_VERSION="$(tomlq -r '.versions.fabricApi' gradle/libs.versions.toml)"
# Download fabric server launch
curl https://meta.fabricmc.net/v2/versions/loader/$MC_VERSION/$LOADER_VERSION/0.11.0/server/jar -o testserver/fabric-server.jar
# eula=true
echo "eula=true" > testserver/eula.txt
# copy artifact into mods folder
cp fabric/build/libs/adventure-platform-fabric-$VERSION.jar testserver/mods/adventure-platform-fabric.jar
# copy API
API_URL=$(curl https://api.modrinth.com/v2/project/fabric-api/version | jq ". | map(select(.version_number == \"$API_VERSION\")) | .[0].files[0].url" -r)
echo "Downloading Fabric API from $API_URL"
curl -L "$API_URL" -o testserver/mods/fabric-api.jar
echo "::endgroup::" # Environment Setup
echo "::group::Server Execution"
pushd testserver/
java -Dadventure.testMode=true -jar fabric-server.jar nogui
if [[ -d "crash-reports" ]]; then
for i in crash-reports/*.txt; do
echo "::error title=Server crashed::$(cat $i)"
done
fi
popd
echo "::endgroup" # Server Execution
echo "# Server Execution" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat testserver/logs/latest.log >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
if [ ! -e "testserver/adventure-test-success.out" ]; then
echo "::error::Server did not exit successfully, see logs for details"
exit 1
fi
- name: "publish"
if: "${{ runner.os == 'Linux' && env.STATUS != 'release' && github.event_name == 'push' && steps.setup.outputs.publishing_branch != '' }}"
run: "./gradlew publish"
env:
ORG_GRADLE_PROJECT_sonatypeUsername: "${{ secrets.SONATYPE_USERNAME }}"
ORG_GRADLE_PROJECT_sonatypePassword: "${{ secrets.SONATYPE_PASSWORD }}"