diff --git a/.changeset/quiet-herons-arrive.md b/.changeset/quiet-herons-arrive.md new file mode 100644 index 0000000..bfa2fce --- /dev/null +++ b/.changeset/quiet-herons-arrive.md @@ -0,0 +1,5 @@ +--- +bump: patch +--- + +Set Homes now publishes to the original Set Homes project page, so servers running the older Set Homes are offered this as an update on the page they already watch. The download is named SetHomes rather than SetHomesTwo. The plugin folder and your existing config.yml are unaffected. diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b813681..a9b2327 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -158,7 +158,7 @@ jobs: if: steps.plan.outputs.release == 'true' && !inputs.dry_run env: NEXT: ${{ steps.plan.outputs.next }} - run: cp "target/SetHomesTwo-$NEXT.jar" "SetHomesTwo.V$NEXT.jar" + run: cp "target/SetHomesTwo-$NEXT.jar" "SetHomes.V$NEXT.jar" - name: Publish to BukkitDev if: steps.plan.outputs.release == 'true' && !inputs.dry_run @@ -174,8 +174,8 @@ jobs: VERSION: ${{ steps.plan.outputs.next }} run: | NOTES=$(bash scripts/release.sh notes --readme README.md --version "$VERSION") - gh release create "v$VERSION" "SetHomesTwo.V$VERSION.jar" \ - --title "SetHomesTwo V$VERSION" \ + gh release create "v$VERSION" "SetHomes.V$VERSION.jar" \ + --title "Set Homes V$VERSION" \ --notes "$NOTES" # An issue closes when the commit that fixed it is contained in the commit diff --git a/scripts/publish-bukkitdev.sh b/scripts/publish-bukkitdev.sh index 6362f70..cc4e62c 100755 --- a/scripts/publish-bukkitdev.sh +++ b/scripts/publish-bukkitdev.sh @@ -7,8 +7,8 @@ set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -# 913275 is set-homes-two. Not 312833 - that is Set Homes v1. -PROJECT_ID=913275 +# 312833 is the Set Homes listing, the one v1 servers already watch for updates. +PROJECT_ID=312833 API=https://dev.bukkit.org/api if [ -z "${CURSEFORGE_TOKEN:-}" ]; then @@ -16,6 +16,15 @@ if [ -z "${CURSEFORGE_TOKEN:-}" ]; then exit 1 fi +# This listing carries Set Homes v1, which last shipped 1.3.1, so anything below +# 2.0.0 would reach those servers as an update that reads as a downgrade. +case "$VERSION" in + 0.*|1.*) + echo "$VERSION is below the 2.0.0 floor for this listing, refusing to publish" >&2 + exit 1 + ;; +esac + GAME_VERSIONS=$(curl -sS -H "X-Api-Token: $CURSEFORGE_TOKEN" "$API/game/versions" \ | jq -f "$SCRIPT_DIR/game-versions.jq" \ | jq -c 'map(.id)') @@ -40,7 +49,7 @@ CHANGELOG=$(bash "$SCRIPT_DIR/release.sh" notes --readme README.md --version "$V # backslashes and newlines. METADATA=$(jq -n \ --arg changelog "$CHANGELOG" \ - --arg displayName "SetHomesTwo V$VERSION" \ + --arg displayName "Set Homes V$VERSION" \ --argjson gameVersions "$GAME_VERSIONS" \ '{ changelog: $changelog, @@ -55,7 +64,7 @@ METADATA=$(jq -n \ RESPONSE=$(curl -sS -w '\n%{http_code}' -X POST "$API/projects/$PROJECT_ID/upload-file" \ -H "X-Api-Token: $CURSEFORGE_TOKEN" \ --form-string "metadata=$METADATA" \ - -F "file=@SetHomesTwo.V$VERSION.jar") + -F "file=@SetHomes.V$VERSION.jar") BODY=$(echo "$RESPONSE" | head -n -1) CODE=$(echo "$RESPONSE" | tail -n 1) diff --git a/scripts/test-publish-bukkitdev.sh b/scripts/test-publish-bukkitdev.sh index 15d19d5..40ef9d1 100644 --- a/scripts/test-publish-bukkitdev.sh +++ b/scripts/test-publish-bukkitdev.sh @@ -163,17 +163,37 @@ else fi DISPLAY_NAME=$(printf '%s' "$METADATA" | jq -r '.displayName // ""' 2>/dev/null) -if [ "$DISPLAY_NAME" = "SetHomesTwo V9.9.9" ]; then +if [ "$DISPLAY_NAME" = "Set Homes V9.9.9" ]; then pass "names the file after the version" else fail "names the file after the version" "got: $DISPLAY_NAME" fi -if has_arg "file=@SetHomesTwo.V9.9.9.jar"; then +if has_arg "file=@SetHomes.V9.9.9.jar"; then pass "uploads the versioned jar" else fail "uploads the versioned jar" "args were: $(args_summary)" fi +# The listing this publishes to carries Set Homes v1, which shipped 1.3.1, so a +# 1.x upload would be offered to those servers as an update. The guard runs +# before the first API call, so a refused run records no curl at all. +REFUSE_ARGS_DIR="$WORK/args-refused" +REFUSE_OUTPUT=$(cd "$WORK/run" && PATH="$WORK/bin:$PATH" CURSEFORGE_TOKEN=test-token \ + VERSION=1.2.3 CURL_ARGS_DIR="$REFUSE_ARGS_DIR" bash "$PUBLISH_SH" 2>&1) +REFUSE_STATUS=$? + +if [ "$REFUSE_STATUS" -ne 0 ]; then + pass "refuses to publish a version below 2.0.0" +else + fail "refuses to publish a version below 2.0.0" "exited 0: $REFUSE_OUTPUT" +fi + +if [ ! -d "$REFUSE_ARGS_DIR" ]; then + pass "calls nothing when it refuses" +else + fail "calls nothing when it refuses" "recorded: $(ls "$REFUSE_ARGS_DIR")" +fi + printf '\n%d passed, %d failed\n' "$PASS" "$FAIL" [ "$FAIL" -eq 0 ]