Merge pull request #28 from kristianwind/release-to-dist-repo
CI / Static checks (push) Successful in 48s
CI / WordPress latest + WooCommerce latest on PHP 8.3 (push) Successful in 1m6s

Publish releases to kw/nolimit-discounts-dist and point the header there
This commit is contained in:
Kristian Wind
2026-09-17 22:39:37 +02:00
committed by GitHub
5 changed files with 40 additions and 4 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ ci_load_conf() {
# leaves the floors empty, every comparison becomes a no-op, and the hollow # leaves the floors empty, every comparison becomes a no-op, and the hollow
# checks these were added to fix come back silently — the same shape of bug. # checks these were added to fix come back silently — the same shape of bug.
local missing= local missing=
for var in PLUGIN_SLUG PLUGIN_MAIN TEXT_DOMAIN NEEDS_WOOCOMMERCE MIN_SHIPPED_PHP_FILES MIN_TRANSLATION_CALLS; do for var in PLUGIN_SLUG PLUGIN_MAIN TEXT_DOMAIN NEEDS_WOOCOMMERCE MIN_SHIPPED_PHP_FILES MIN_TRANSLATION_CALLS RELEASE_REPO; do
[ -n "${!var:-}" ] || missing="$missing $var" [ -n "${!var:-}" ] || missing="$missing $var"
done done
if [ -n "$missing" ]; then if [ -n "$missing" ]; then
+15
View File
@@ -51,3 +51,18 @@ MIN_SHIPPED_PHP_FILES=5
# Set to 0 for a plugin with no translatable strings: the check then warns # Set to 0 for a plugin with no translatable strings: the check then warns
# instead of failing, so zero is never silent either way. # instead of failing, so zero is never silent either way.
MIN_TRANSLATION_CALLS=60 MIN_TRANSLATION_CALLS=60
# Where releases are published, when that is not the repository running the
# workflow. The source repo is kw/nolimit-discounts; the plugin's update feed
# is a separate PUBLIC repo holding built zips only, so a shop can fetch
# updates without credentials and without the source being readable.
#
# 🔴 This and the "Update URI:" header in the plugin file must name the same
# repository. ci/static.sh fails when they disagree — a feed that moves while
# the header stands still is how every installed copy silently stops receiving
# updates, and nothing announces it because latest_release() just returns false.
#
# Publishing here needs a token with write access to that OTHER repository. The
# job token only covers the repo it runs in, so this is a cross-repo PAT and
# Kristian's to add.
RELEASE_REPO=kw/nolimit-discounts-dist
+8 -2
View File
@@ -23,8 +23,14 @@ ci_load_conf
zip="build/$PLUGIN_SLUG.zip" zip="build/$PLUGIN_SLUG.zip"
[ -f "$zip" ] || { echo "$zip does not exist — run ci/build-zip.sh first." >&2; exit 1; } [ -f "$zip" ] || { echo "$zip does not exist — run ci/build-zip.sh first." >&2; exit 1; }
owner="${GITHUB_REPOSITORY%%/*}" # RELEASE_REPO wins over the repository running the workflow: releases go to a
repo="${GITHUB_REPOSITORY#*/}" # separate public dist repo, so the source can be private while a shop still
# fetches its update anonymously. Falls back to the running repo, which is what
# a plugin without a split still wants.
target="${RELEASE_REPO:-$GITHUB_REPOSITORY}"
owner="${target%%/*}"
repo="${target#*/}"
echo "Publishing $TAG to $owner/$repo" >&2
# The tag message is the announcement, so it has to survive the checkout. # The tag message is the announcement, so it has to survive the checkout.
# #
+15
View File
@@ -160,6 +160,21 @@ for readme in readme.txt README.txt; do
|| note_fail "$readme has 'Stable tag: $stable' but the plugin header says $version." || note_fail "$readme has 'Stable tag: $stable' but the plugin header says $version."
done done
ci_step "the update feed and the release target name the same repository"
# 🔴 The header is what every installed copy polls; RELEASE_REPO is where the
# zip is actually published. If they disagree, the shop keeps asking an address
# nothing is published to any more and quietly stops receiving updates —
# latest_release() just returns false, and nothing says so. Same failure as a
# privacy page that stands still while the code moves: the two must change in
# one commit, and this is what makes that impossible to forget.
update_uri=$(ci_plugin_header 'Update URI')
echo " Update URI: ${update_uri:-<missing>}"
echo " RELEASE_REPO: $RELEASE_REPO"
case "$update_uri" in
*/"$RELEASE_REPO") echo " they agree" ;;
*) note_fail "Update URI is '$update_uri' but releases are published to '$RELEASE_REPO'. Installed copies poll the header, so they would stop being offered updates without a word." ;;
esac
ci_step "no secrets in tracked files" ci_step "no secrets in tracked files"
# Suggested by the AI-manager port, and it costs nothing: a pushed key cannot be # Suggested by the AI-manager port, and it costs nothing: a pushed key cannot be
# unpushed. It has to be rotated, and the window between the push and noticing # unpushed. It has to be rotated, and the window between the push and noticing
+1 -1
View File
@@ -2,7 +2,7 @@
/** /**
* Plugin Name: Nolimit Discounts * Plugin Name: Nolimit Discounts
* Plugin URI: https://gitea.nolimit.dk/kw/woo-discount-manager * Plugin URI: https://gitea.nolimit.dk/kw/woo-discount-manager
* Update URI: https://gitea.nolimit.dk/kw/woo-discount-manager * Update URI: https://gitea.nolimit.dk/kw/nolimit-discounts-dist
* Description: Apply discounts and show/hide shipping methods based on the customer's email address (full address, domain or partial match). * Description: Apply discounts and show/hide shipping methods based on the customer's email address (full address, domain or partial match).
* Version: 1.4.6 * Version: 1.4.6
* Author: Kristian Wind * Author: Kristian Wind