Skip to content
Open
Show file tree
Hide file tree
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
143 changes: 143 additions & 0 deletions .github/workflows/auto-tag-beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
name: Auto Tag Beta

# On every push to a `claude/**` branch:
# 1. Read the current beta base from build.gradle (e.g. "26.1.2-beta") so
# the tag prefix tracks build.gradle automatically and only one place
# needs editing when MC ships a new version.
# 2. Compute the next <base>.N tag (max existing + 1; first run = .1).
# 3. Sync build.gradle to that tag, commit it back with [skip ci] so this
# workflow does not loop on its own commit.
# 4. Build the spigot jar with the JDK 25 toolchain Paper 26.1+ requires.
# 5. Create the tag + GitHub Release and upload the spigot jar as an asset.
#
# All `claude/**` branches share a single tag namespace. Concurrency is
# serialized below (`group: auto-tag-beta`) so two simultaneous pushes can't
# race for the same tag, but the counter (e.g. .5 -> .6 -> .7) is still
# global. If you need per-branch numbering, change the concurrency group and
# put the branch name into the tag prefix.
#
# The PR itself is created out-of-band by a human/operator with proper gh
# credentials; this workflow only handles tagging and releases.

on:
push:
branches:
- 'claude/**'

concurrency:
group: auto-tag-beta
cancel-in-progress: false

permissions:
contents: write

jobs:
release:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}

steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Compute next beta version
id: next
run: |
set -euo pipefail
git fetch --tags --force
# Derive the beta base (e.g. "26.1.2-beta") from build.gradle so
# bumping MC versions only requires editing build.gradle, not this
# workflow. Expects the current version to look like "<base>.<N>".
BASE=$(sed -nE "s/^ *version *= *'(.+)\.[0-9]+'.*/\1/p" build.gradle | head -n1)
if [ -z "${BASE}" ]; then
echo "Could not derive beta base from build.gradle" >&2
exit 1
fi
# Escape regex metacharacters in BASE before splicing it into sed
# below; the `.`s in e.g. "26.1.2-beta" would otherwise match any
# char and let stray tags like "26X1X2-beta.5" slip through.
BASE_RE=$(printf '%s' "${BASE}" | sed 's/[.[\^$*+?(){}|\\]/\\&/g')
LAST=$(git tag --list "${BASE}.*" \
| sed -n "s/^${BASE_RE}\.\([0-9]\+\)\$/\1/p" \
| sort -n | tail -n 1)
NEXT=$(( ${LAST:-0} + 1 ))
TAG="${BASE}.${NEXT}"
echo "base=${BASE}" >> "$GITHUB_OUTPUT"
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
echo "Next tag: ${TAG}"

- name: Sync build.gradle version
run: |
set -euo pipefail
sed -i -E "s/^( *version *= *')[^']+(')/\1${{ steps.next.outputs.tag }}\2/" build.gradle
grep -E "^ *version *= *'" build.gradle

- name: Commit version bump
env:
TAG: ${{ steps.next.outputs.tag }}
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
if ! git diff --quiet -- build.gradle; then
git add build.gradle
git commit -m "chore(release): bump version to ${TAG} [skip ci]"
git push origin "HEAD:${GITHUB_REF_NAME}"
else
echo "build.gradle already at ${TAG}; nothing to commit."
fi

- name: Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: '21'
distribution: 'temurin'

- name: Set up JDK 25
uses: actions/setup-java@v5
with:
java-version: '25'
distribution: 'temurin'
cache: gradle

- name: Build spigot jar
env:
USERNAME: ${{ secrets.USERNAME }}
TOKEN: ${{ secrets.TOKEN }}
JAVA_HOME: ${{ env.JAVA_HOME_21_X64 }}
# Run Gradle itself on JDK 21 (Shadow 9.x is happy there); the
# paperweight subproject toolchain auto-uses JDK 25 via foojay.
run: |
./gradlew :spigot:build \
-Porg.gradle.java.installations.paths="${JAVA_HOME_25_X64},${JAVA_HOME_21_X64}"

- name: Locate built jar
id: jar
run: |
set -euo pipefail
JAR_FILE=$(ls target/Dynmap-*-spigot.jar | tail -n 1)
echo "path=${JAR_FILE}" >> "$GITHUB_OUTPUT"
echo "name=$(basename "${JAR_FILE}")" >> "$GITHUB_OUTPUT"

- name: Create tag and GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ steps.next.outputs.tag }}
BASE: ${{ steps.next.outputs.base }}
JAR_PATH: ${{ steps.jar.outputs.path }}
run: |
set -euo pipefail
# The version-bump push (if any) updated origin; re-resolve HEAD.
git fetch origin "${GITHUB_REF_NAME}"
SHA=$(git rev-parse "origin/${GITHUB_REF_NAME}")
git tag "${TAG}" "${SHA}"
git push origin "${TAG}"
gh release create "${TAG}" \
"${JAR_PATH}" \
--title "Dynmap ${TAG}" \
--notes "Automated ${BASE} build from commit ${SHA}." \
--prerelease \
--target "${SHA}"
11 changes: 4 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,8 @@ jobs:
echo "jar_name=$(basename $JAR_FILE)" >> $GITHUB_OUTPUT

- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ steps.find_jar.outputs.jar_file }}
asset_name: ${{ steps.find_jar.outputs.jar_name }}
asset_content_type: application/java-archive
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload "${{ github.event.release.tag_name }}" \
"${{ steps.find_jar.outputs.jar_file }}" --clobber
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ allprojects {
apply plugin: 'java'

group = 'us.dynmap'
version = '3.9-SNAPSHOT'
version = '26.1.2-beta.9'

}

Expand All @@ -47,7 +47,7 @@ subprojects {
apply plugin: 'maven-publish'

// Set Java version - paperweight modules define their own Java version
if (project.name != 'bukkit-helper-121-11') {
if (project.name != 'bukkit-helper-121-11' && project.name != 'bukkit-helper-26-1-2') {
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
Expand Down
54 changes: 54 additions & 0 deletions bukkit-helper-26-1-2/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
plugins {
id 'io.papermc.paperweight.userdev'
}

eclipse {
project {
name = "Dynmap(Spigot-26.1.2)"
}
}

description = 'bukkit-helper-26.1.2'

// Minecraft 26.1+ Paper requires Java 25 at runtime, so the userdev setup
// (paperclip patching) needs to launch under Java 25 as well. The Shadow
// plugin in this build runs on JDK 21 and cannot read Java 25 (major 69)
// bytecode, so emit Java 21 bytecode here while keeping the Java 25 toolchain
// for compilation against Paper's API. `options.release` (rather than
// source/targetCompatibility) keeps the org.gradle.jvm.version attribute at
// 25 so paper-api (which requires JVM 25) still resolves.
//
// FIXME: drop the toolchain-25 + release-21 + JVM-25-attribute dance once the
// Shadow plugin can run on JDK 25 (Gradle would then run on 25 too and read
// major-69 class files natively).
java {
toolchain.languageVersion = JavaLanguageVersion.of(25)
}
tasks.named('compileJava').configure {
options.release = 21
}

// `options.release = 21` would normally narrow the resolution attribute to
// JVM 21, but paper-api 26.1.2 declares JVM 25 in its module metadata. Force
// the consumer attribute back to 25 so dependency resolution succeeds; the
// emitted bytecode is still Java 21 thanks to `--release`.
[configurations.compileClasspath, configurations.runtimeClasspath].each { cfg ->
cfg.attributes {
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 25)
}
}

dependencies {
implementation project(':bukkit-helper')
implementation project(':dynmap-api')
implementation project(path: ':DynmapCore', configuration: 'shadow')
// Paper publishes 26.1.2 dev bundles as "26.1.2.build.<N>-stable" (no -R0.1-SNAPSHOT for the new version scheme)
paperweight.paperDevBundle("26.1.2.build.57-stable")
}

// Paper 26.1+ ships Mojang-mapped at runtime; the dev bundle no longer
// provides reobf-to-Spigot mappings, so the reobfJar task can't run. Disable
// it. Consumers (spigot) must then pull from the `runtimeElements`
// configuration explicitly because paperweight registers `reobf` as the
// preferred runtime variant.
tasks.named('reobfJar').configure { enabled = false }
Loading