From 43f84fb365d1174f5019fd4b8c47293294dc0b4b Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Fri, 23 Oct 2026 17:04:19 +0300 Subject: [PATCH 01/34] Add WordPress.org plugin page workflow - sync readme.txt to the Stable tag and trunk without a release - mirror the assets directory to SVN /assets - validate asset names, sizes, image format and dimensions, blueprints - fail on changes outside the plugin page files - show changes in the job summary - dry run by default, artifact contains only what would be committed --- .../workflows/wordpress-org-plugin-page.yml | 641 ++++++++++++++++++ 1 file changed, 641 insertions(+) create mode 100644 .github/workflows/wordpress-org-plugin-page.yml diff --git a/.github/workflows/wordpress-org-plugin-page.yml b/.github/workflows/wordpress-org-plugin-page.yml new file mode 100644 index 000000000..5c4d9f8b1 --- /dev/null +++ b/.github/workflows/wordpress-org-plugin-page.yml @@ -0,0 +1,641 @@ +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json + +name: wordpress.org plugin page + +on: + workflow_call: + inputs: + SVN_PLUGIN_SLUG: + description: "WordPress.org plugin slug (e.g., 'woocommerce')" + type: string + required: true + + GIT_REF: + description: "Git ref to read readme.txt and the assets directory from (tag, branch, or commit)" + type: string + required: true + + SYNC_README: + description: "Update readme.txt in SVN trunk and in the tag referenced by 'Stable tag'" + type: boolean + default: true + required: false + + SYNC_ASSETS: + description: "Mirror ASSETS_DIR to the SVN /assets directory (banners, icons, screenshots, blueprints)" + type: boolean + default: true + required: false + + ASSETS_DIR: + description: "Directory in the Git repository holding the WordPress.org assets" + type: string + default: ".wordpress-org" + required: false + + DRY_RUN: + description: "Upload the files that would be committed as an artifact instead of committing to SVN" + type: boolean + default: true + required: false + + secrets: + SVN_USERNAME: + required: true + + SVN_PASSWORD: + required: true + +jobs: + update_plugin_page: + runs-on: ubuntu-latest + timeout-minutes: 10 + permissions: + contents: read + env: + # Filename rules of the WordPress.org plugin directory importer, restricted to the documented + # banner and icon resolutions and to lowercase names (a rule of this workflow, not of WordPress.org). + # Shared by the asset validation and the scope guard, so they can't drift apart. + # Locale suffix: (-rtl)?(-[a-z]{2,3}(_[A-Z]{2})?(_[a-z0-9]+)?)? + BANNER_RE: '^banner-(772x250|1544x500)(-rtl)?(-[a-z]{2,3}(_[A-Z]{2})?(_[a-z0-9]+)?)?\.(png|jpg|jpeg|gif)$' + ICON_RE: '^icon-(128x128|256x256)(-rtl)?(-[a-z]{2,3}(_[A-Z]{2})?(_[a-z0-9]+)?)?\.(png|jpg|jpeg|gif)$' + SCREENSHOT_RE: '^screenshot-[0-9]+(-rtl)?(-[a-z]{2,3}(_[A-Z]{2})?(_[a-z0-9]+)?)?\.(png|jpg|jpeg|gif)$' + BLUEPRINT_RE: '^blueprints/blueprint[-A-Za-z0-9_]*\.json$' + steps: + - name: Install required tools + run: | + sudo apt-get update -y + sudo apt-get install -y subversion rsync jq imagemagick + + - name: Validate inputs + env: + SVN_PLUGIN_SLUG: ${{ inputs.SVN_PLUGIN_SLUG }} + GIT_REF: ${{ inputs.GIT_REF }} + SYNC_README: ${{ inputs.SYNC_README }} + SYNC_ASSETS: ${{ inputs.SYNC_ASSETS }} + ASSETS_DIR: ${{ inputs.ASSETS_DIR }} + run: | + set -euo pipefail + + if [[ ! "$SVN_PLUGIN_SLUG" =~ ^[a-z0-9-]+$ ]]; then + echo "❌ Invalid plugin slug: $SVN_PLUGIN_SLUG" + echo " WordPress.org slugs may only contain lowercase letters, numbers, and hyphens" + exit 1 + fi + + echo "✅ Valid plugin slug: $SVN_PLUGIN_SLUG" + + if ! git check-ref-format --allow-onelevel "$GIT_REF"; then + echo "❌ Invalid Git ref name: $GIT_REF" + exit 1 + fi + + if [ "$SYNC_README" != "true" ] && [ "$SYNC_ASSETS" != "true" ]; then + echo "❌ Nothing to do: both SYNC_README and SYNC_ASSETS are disabled" + exit 1 + fi + + # ASSETS_DIR is used as an rsync source, so keep it inside the repository. + if [[ ! "$ASSETS_DIR" =~ ^[A-Za-z0-9._-]+(/[A-Za-z0-9._-]+)*$ ]] || [[ "/$ASSETS_DIR/" == *"/../"* ]]; then + echo "❌ Invalid ASSETS_DIR: $ASSETS_DIR" + echo " Must be a relative path inside the repository, without '..' segments" + exit 1 + fi + + echo "✅ Inputs are valid" + + # GIT_REF is validated above, so it is safe to pass it to actions/checkout directly. + - name: Checkout git repository + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + with: + ref: ${{ inputs.GIT_REF }} + persist-credentials: false + + - name: Resolve Git revision + id: git_revision + run: | + set -euo pipefail + echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" + + - name: Validate readme.txt + id: readme + if: inputs.SYNC_README == true + run: | + set -euo pipefail + + if [ ! -f readme.txt ]; then + echo "❌ readme.txt not found" + exit 1 + fi + + STABLE_TAG=$(grep -m1 -iE '^[[:space:]]*([*+-][[:space:]]+)?Stable tag:' readme.txt \ + | sed -E 's/^.*Stable tag:[[:space:]]*//I; s/[[:space:]]+$//' | tr -d '\r' || true) + + if [ -z "$STABLE_TAG" ]; then + echo "❌ Could not extract 'Stable tag:' from readme.txt" + exit 1 + fi + + if [ "$STABLE_TAG" = "trunk" ]; then + echo "❌ 'Stable tag: trunk' is not supported (and discouraged by WordPress.org)" + exit 1 + fi + + # This workflow never creates versions, it only has to find the existing tag, + # so any numeric dotted version with 1-4 parts is accepted here. This intentionally + # differs from the strict X.Y.Z check of wordpress-org-release, which creates new tags. + if [[ ! "$STABLE_TAG" =~ ^[0-9]+(\.[0-9]+){0,3}$ ]]; then + echo "❌ Unexpected 'Stable tag' format in readme.txt: $STABLE_TAG" + exit 1 + fi + + echo "STABLE_TAG=$STABLE_TAG" >> "$GITHUB_OUTPUT" + echo "✅ readme.txt found, Stable tag: $STABLE_TAG" + + - name: Validate assets directory + if: inputs.SYNC_ASSETS == true + env: + ASSETS_DIR: ${{ inputs.ASSETS_DIR }} + run: | + set -euo pipefail + + if [ ! -d "$ASSETS_DIR" ]; then + echo "❌ Assets directory not found: $ASSETS_DIR" + exit 1 + fi + + ERRORS=0 + + # Symlinks would be skipped by rsync and silently leave the old file in SVN, + # and any directory other than blueprints/ would be committed as is. + mapfile -t UNSUPPORTED < <(cd "$ASSETS_DIR" && find . -mindepth 1 ! -path '*/.*' \ + \( ! -type f ! -type d -o -type d ! -path ./blueprints \) -printf '%P\n' | LC_ALL=C sort) + + for ENTRY in "${UNSUPPORTED[@]}"; do + if [ -d "$ASSETS_DIR/$ENTRY" ] && [ ! -L "$ASSETS_DIR/$ENTRY" ]; then + echo "❌ $ENTRY/ is not supported, only the blueprints/ subdirectory is allowed" + else + echo "❌ $ENTRY is not a regular file (symlinks are not supported)" + fi + ERRORS=1 + done + + # Hidden files (.gitkeep, .DS_Store, ...) are ignored here and by the sync below. + mapfile -t FILES < <(cd "$ASSETS_DIR" && find . -type f ! -path '*/.*' -printf '%P\n' | LC_ALL=C sort) + + # The sync mirrors this directory, so an empty directory would wipe the plugin page. + if [ "${#FILES[@]}" -eq 0 ]; then + echo "❌ Assets directory is empty: $ASSETS_DIR" + echo " Syncing it would delete every asset from WordPress.org. Aborting." + exit 1 + fi + + HAS_RASTER_ICON=0 + HAS_SVG_ICON=0 + BLUEPRINT_COUNT=0 + + for FILE in "${FILES[@]}"; do + SIZE=$(stat -c %s "$ASSETS_DIR/$FILE") + # Banners and raster icons must have the dimensions their name says, + # WordPress.org trusts the name and would render a different size distorted. + EXPECTED_DIMENSIONS="" + + if [[ "$FILE" =~ $BANNER_RE ]]; then + LIMIT=$((4 * 1024 * 1024)) + EXPECTED_DIMENSIONS="${BASH_REMATCH[1]}" + elif [[ "$FILE" =~ $ICON_RE ]]; then + LIMIT=$((1 * 1024 * 1024)) + EXPECTED_DIMENSIONS="${BASH_REMATCH[1]}" + HAS_RASTER_ICON=1 + elif [ "$FILE" = "icon.svg" ]; then + LIMIT=$((1 * 1024 * 1024)) + HAS_SVG_ICON=1 + elif [[ "$FILE" =~ $SCREENSHOT_RE ]]; then + LIMIT=$((10 * 1024 * 1024)) + elif [[ "$FILE" =~ $BLUEPRINT_RE ]]; then + LIMIT=$((100 * 1024)) + BLUEPRINT_COUNT=$((BLUEPRINT_COUNT + 1)) + # The importer requires a JSON object or array, scalars are rejected. + if ! jq -e 'type == "object" or type == "array"' "$ASSETS_DIR/$FILE" >/dev/null 2>&1; then + echo "❌ $FILE is not a valid JSON object or array" + ERRORS=1 + fi + else + LOWER=$(tr '[:upper:]' '[:lower:]' <<< "$FILE") + if [[ "$LOWER" =~ $BANNER_RE ]] || [[ "$LOWER" =~ $ICON_RE ]] || [[ "$LOWER" =~ $SCREENSHOT_RE ]]; then + echo "❌ $FILE must be lowercase (required by this workflow)" + else + echo "❌ $FILE is not a recognized WordPress.org asset (WordPress.org would ignore it)" + fi + ERRORS=1 + continue + fi + + if [ "$SIZE" -eq 0 ]; then + echo "❌ $FILE is empty" + ERRORS=1 + continue + elif [ "$SIZE" -gt "$LIMIT" ]; then + echo "❌ $FILE is $SIZE bytes, WordPress.org limit is $LIMIT bytes" + ERRORS=1 + fi + + # The real format must match the extension. This also catches Git LFS pointer files, + # which actions/checkout fetches instead of the images unless LFS is enabled. + case "$FILE" in + *.png) EXPECTED_FORMAT="PNG" ;; + *.jpg|*.jpeg) EXPECTED_FORMAT="JPEG" ;; + *.gif) EXPECTED_FORMAT="GIF" ;; + *) continue ;; + esac + + # [0] reads only the first frame of animated GIFs. + FORMAT=$(identify -ping -format '%m' "$ASSETS_DIR/${FILE}[0]" 2>/dev/null || true) + if [ "$FORMAT" != "$EXPECTED_FORMAT" ]; then + echo "❌ $FILE is ${FORMAT:-not a readable image} (expected $EXPECTED_FORMAT). Git LFS files are not supported" + ERRORS=1 + continue + fi + + if [ -n "$EXPECTED_DIMENSIONS" ]; then + DIMENSIONS=$(identify -ping -format '%wx%h' "$ASSETS_DIR/${FILE}[0]" 2>/dev/null || true) + if [ "$DIMENSIONS" != "$EXPECTED_DIMENSIONS" ]; then + echo "❌ $FILE is ${DIMENSIONS:-unreadable}, expected $EXPECTED_DIMENSIONS" + ERRORS=1 + fi + fi + done + + # WordPress.org would show icon.svg alone, but its Plugin Assets docs recommend a raster fallback. + if [ "$HAS_SVG_ICON" = "1" ] && [ "$HAS_RASTER_ICON" = "0" ]; then + echo "❌ icon.svg requires a PNG/JPG/GIF icon (icon-128x128 or icon-256x256) as fallback (required by this workflow)" + ERRORS=1 + fi + + # WordPress.org would import only the first 10 and skip the rest. + if [ "$BLUEPRINT_COUNT" -gt 10 ]; then + echo "❌ $BLUEPRINT_COUNT blueprints found, at most 10 are allowed (required by this workflow, WordPress.org imports only 10)" + ERRORS=1 + fi + + [ "$ERRORS" = "1" ] && exit 1 + + echo "✅ ${#FILES[@]} asset(s) in $ASSETS_DIR are valid" + + - name: Checkout SVN repository + env: + SVN_PLUGIN_SLUG: ${{ inputs.SVN_PLUGIN_SLUG }} + SYNC_README: ${{ inputs.SYNC_README }} + SYNC_ASSETS: ${{ inputs.SYNC_ASSETS }} + STABLE_TAG: ${{ steps.readme.outputs.STABLE_TAG }} + run: | + set -euo pipefail + + export SVN_REPO_ROOT="${RUNNER_TEMP}/svn_repository/${SVN_PLUGIN_SLUG}" + echo "SVN_REPO_ROOT=$SVN_REPO_ROOT" >> "$GITHUB_ENV" + + # Sparse checkout: only the files this workflow may change are fetched. + # trunk and tags stay (nearly) empty, which keeps this fast for plugins with large histories. + mkdir -p "$(dirname "$SVN_REPO_ROOT")" + svn checkout "https://plugins.svn.wordpress.org/${SVN_PLUGIN_SLUG}" "$SVN_REPO_ROOT" --depth immediates + cd "$SVN_REPO_ROOT" + + if [ "$SYNC_README" = "true" ]; then + svn update trunk/readme.txt + svn update tags --set-depth immediates + + if [ -d "tags/$STABLE_TAG" ]; then + svn update "tags/$STABLE_TAG/readme.txt" + fi + fi + + if [ "$SYNC_ASSETS" = "true" ]; then + if [ -d assets ]; then + svn update assets --set-depth infinity + else + echo "ℹ️ No /assets directory in SVN yet, creating it" + svn mkdir assets + fi + fi + + - name: Verify Stable tag matches WordPress.org + if: inputs.SYNC_README == true + env: + SVN_PLUGIN_SLUG: ${{ inputs.SVN_PLUGIN_SLUG }} + STABLE_TAG: ${{ steps.readme.outputs.STABLE_TAG }} + run: | + set -euo pipefail + + cd "$SVN_REPO_ROOT" + + if [ ! -f trunk/readme.txt ]; then + echo "❌ trunk/readme.txt does not exist in SVN" + exit 1 + fi + + SVN_STABLE_TAG=$(grep -m1 -iE '^[[:space:]]*([*+-][[:space:]]+)?Stable tag:' trunk/readme.txt \ + | sed -E 's/^.*Stable tag:[[:space:]]*//I; s/[[:space:]]+$//' | tr -d '\r' || true) + + # Changing the Stable tag means publishing a different version - that is a release. + if [ "$STABLE_TAG" != "$SVN_STABLE_TAG" ]; then + echo "❌ readme.txt Stable tag ($STABLE_TAG) does not match Stable tag in SVN trunk ($SVN_STABLE_TAG)" + echo " This workflow cannot change the Stable tag. Use the wordpress-org-release workflow to publish a new version," + echo " or pass a GIT_REF whose readme.txt matches the currently published version." + exit 1 + fi + + if [ ! -f "tags/$STABLE_TAG/readme.txt" ]; then + echo "❌ tags/$STABLE_TAG/readme.txt does not exist in SVN" + echo " Check: https://plugins.svn.wordpress.org/${SVN_PLUGIN_SLUG}/tags/" + exit 1 + fi + + echo "✅ Stable tag $STABLE_TAG matches SVN trunk and exists as a published tag" + + - name: Synchronize readme.txt + if: inputs.SYNC_README == true + env: + STABLE_TAG: ${{ steps.readme.outputs.STABLE_TAG }} + run: | + set -euo pipefail + + cd "$SVN_REPO_ROOT" + GIT_README="$GITHUB_WORKSPACE/readme.txt" + TAG_README="tags/$STABLE_TAG/readme.txt" + + readme_header() { + grep -m1 -iE "^[[:space:]]*([*+-][[:space:]]+)?$1:" "$2" \ + | sed -E 's/^[^:]*:[[:space:]]*//; s/[[:space:]]+$//' | tr -d '\r' || true + } + + # These headers change the compatibility info of the published version, which is more than cosmetic. + for HEADER in "Requires at least" "Requires PHP"; do + OLD_VALUE=$(readme_header "$HEADER" "$TAG_README") + NEW_VALUE=$(readme_header "$HEADER" "$GIT_README") + if [ "$OLD_VALUE" != "$NEW_VALUE" ]; then + echo "::warning title=$HEADER changed::'$HEADER' changes from '${OLD_VALUE:-(none)}' to '${NEW_VALUE:-(none)}' for the already published version $STABLE_TAG. Make sure version $STABLE_TAG really has these requirements." + fi + done + + # If trunk's readme already differs from the published one, trunk holds unreleased changes + # (e.g. a trunk preview created by wordpress-org-release with UPDATE_TRUNK_ONLY). + # Overwriting it would silently revert those, so trunk is left alone in that case. + if cmp -s trunk/readme.txt "$TAG_README"; then + TRUNK_IN_SYNC=true + else + TRUNK_IN_SYNC=false + fi + + # The plugin page is rendered from the readme.txt of the Stable tag. + cp "$GIT_README" "$TAG_README" + echo "✅ Updated $TAG_README" + + if [ "$TRUNK_IN_SYNC" = "true" ]; then + cp "$GIT_README" trunk/readme.txt + echo "✅ Updated trunk/readme.txt" + elif cmp -s trunk/readme.txt "$GIT_README"; then + echo "ℹ️ trunk/readme.txt already matches readme.txt from Git" + else + echo "::warning title=trunk/readme.txt left unchanged::SVN trunk contains unreleased readme.txt changes (likely a trunk preview). Only $TAG_README was updated. Make sure the same change is part of the upcoming release." + fi + + - name: Synchronize assets + if: inputs.SYNC_ASSETS == true + env: + ASSETS_DIR: ${{ inputs.ASSETS_DIR }} + run: | + set -euo pipefail + + rsync -rc \ + --itemize-changes \ + --delete \ + --exclude='.*' \ + "$GITHUB_WORKSPACE/$ASSETS_DIR/" "$SVN_REPO_ROOT/assets/" + + cd "$SVN_REPO_ROOT" + svn add assets --force --depth infinity --quiet + + MISSING=$(svn status assets | grep '^!' | cut -c9- || true) + + if [ -n "$MISSING" ]; then + echo "$MISSING" | while IFS= read -r file; do + svn delete "$file@" # @ suffix handles files with @ in name + done + fi + + # Without a correct svn:mime-type, browsers download assets instead of displaying them. + # 'svn add' marks binaries as application/octet-stream, so this also fixes newly added files. + find assets -type f | while IFS= read -r file; do + case "$file" in + *.png) MIME_TYPE="image/png" ;; + *.jpg|*.jpeg) MIME_TYPE="image/jpeg" ;; + *.gif) MIME_TYPE="image/gif" ;; + *.svg) MIME_TYPE="image/svg+xml" ;; + *.json) MIME_TYPE="application/json" ;; + *) continue ;; + esac + + if [ "$(svn propget svn:mime-type "$file@" 2>/dev/null || true)" != "$MIME_TYPE" ]; then + svn propset --quiet svn:mime-type "$MIME_TYPE" "$file@" + fi + done + + - name: Verify only plugin page files are changed + env: + SYNC_README: ${{ inputs.SYNC_README }} + SYNC_ASSETS: ${{ inputs.SYNC_ASSETS }} + STABLE_TAG: ${{ steps.readme.outputs.STABLE_TAG }} + run: | + set -euo pipefail + + cd "$SVN_REPO_ROOT" + + # Defense in depth: this workflow must never touch plugin code, and only touches + # what the enabled options allow. Readme paths are matched literally (no regex), + # so version dots can't act as wildcards. + is_allowed() { + local STATUS="$1" FILE="$2" + + if [ "$SYNC_README" = "true" ]; then + case "$FILE" in + trunk/readme.txt|"tags/$STABLE_TAG/readme.txt") return 0 ;; + esac + fi + + if [ "$SYNC_ASSETS" = "true" ]; then + case "$FILE" in + assets|assets/blueprints) return 0 ;; + assets/*) + # Removing a file is always fine, e.g. a legacy file with a name WordPress.org ignores. + [ "$STATUS" = "D" ] && return 0 + local ASSET="${FILE#assets/}" + [ "$ASSET" = "icon.svg" ] && return 0 + [[ "$ASSET" =~ $BANNER_RE || "$ASSET" =~ $ICON_RE || "$ASSET" =~ $SCREENSHOT_RE || "$ASSET" =~ $BLUEPRINT_RE ]] && return 0 + ;; + esac + fi + + return 1 + } + + UNEXPECTED=$(svn status | while IFS= read -r line; do + if ! is_allowed "${line:0:1}" "${line:8}"; then + echo "$line" + fi + done) + + if [ -n "$UNEXPECTED" ]; then + echo "❌ Unexpected changes outside of the plugin page files:" + echo "$UNEXPECTED" + exit 1 + fi + + echo "✅ Only plugin page files are changed" + + - name: Show SVN changes + id: svn_status + env: + SYNC_README: ${{ inputs.SYNC_README }} + SYNC_ASSETS: ${{ inputs.SYNC_ASSETS }} + STABLE_TAG: ${{ steps.readme.outputs.STABLE_TAG }} + run: | + set -euo pipefail + + cd "$SVN_REPO_ROOT" + + # The commit and the dry run preview share this list. + COMMIT_PATHS_FILE="${RUNNER_TEMP}/commit-paths.txt" + echo "COMMIT_PATHS_FILE=$COMMIT_PATHS_FILE" >> "$GITHUB_ENV" + : > "$COMMIT_PATHS_FILE" + README_PATHS=() + + if [ "$SYNC_README" = "true" ]; then + README_PATHS=(trunk/readme.txt "tags/$STABLE_TAG/readme.txt") + printf '%s\n' "${README_PATHS[@]}" >> "$COMMIT_PATHS_FILE" + fi + + if [ "$SYNC_ASSETS" = "true" ]; then + echo assets >> "$COMMIT_PATHS_FILE" + fi + + STATUS=$(svn status) + + # Content (first column) or property (second column) changes + if grep -E '^([ADMR~]|.M)' >/dev/null <<< "$STATUS"; then + echo "HAS_CHANGES=true" >> "$GITHUB_OUTPUT" + else + echo "HAS_CHANGES=false" >> "$GITHUB_OUTPUT" + echo "✅ The WordPress.org plugin page is already up to date, nothing to commit." | tee -a "$GITHUB_STEP_SUMMARY" + exit 0 + fi + + DELETED=$(grep '^D' <<< "$STATUS" | cut -c9- || true) + + # Readme files may contain ``` themselves, so a longer fence is used. + { + echo '### SVN changes' + echo '`````' + echo "$STATUS" + echo '`````' + + if [ -n "$DELETED" ]; then + echo '### ⚠️ Removed from WordPress.org' + echo '`````' + echo "$DELETED" + echo '`````' + fi + + # Readme diffs are text and worth reviewing; binary assets are listed by status only. + if [ "${#README_PATHS[@]}" -gt 0 ]; then + echo '### readme.txt diff' + echo '`````diff' + svn diff "${README_PATHS[@]}" + echo '`````' + fi + } | tee -a "$GITHUB_STEP_SUMMARY" + + - name: Commit changes to SVN repository + if: inputs.DRY_RUN == false + env: + SVN_USERNAME: ${{ secrets.SVN_USERNAME }} + SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} + GIT_REF: ${{ inputs.GIT_REF }} + SHORT_SHA: ${{ steps.git_revision.outputs.SHORT_SHA }} + HAS_CHANGES: ${{ steps.svn_status.outputs.HAS_CHANGES }} + run: | + set -euo pipefail + + # Unlike a release, updating the plugin page is idempotent: re-running without changes is fine. + if [ "$HAS_CHANGES" != "true" ]; then + echo "::notice title=No changes::The WordPress.org plugin page is already up to date" + exit 0 + fi + + cd "$SVN_REPO_ROOT" + + mapfile -t COMMIT_PATHS < "$COMMIT_PATHS_FILE" + # svn log -v lists the exact paths, so the message doesn't repeat them. + COMMIT_MESSAGE="Update plugin page from ${GIT_REF}@${SHORT_SHA}" + COMMIT_LOG="${RUNNER_TEMP}/svn-commit.log" + + # WordPress.org SVN doesn't support SSH keys or tokens. + # Keeping credentials as step-level env vars with --no-auth-cache is the best available option. + # The password is piped via stdin, so it never shows up in the process list (argv). + # printf must stay the bash builtin, and set -x must not be enabled in this step. + echo '🚀 Committing...' + + if ! printf '%s' "$SVN_PASSWORD" | svn commit "${COMMIT_PATHS[@]}" \ + --username "$SVN_USERNAME" \ + --password-from-stdin \ + --no-auth-cache \ + --non-interactive \ + -m "$COMMIT_MESSAGE" 2>&1 | tee "$COMMIT_LOG"; then + + # SVN commits are atomic: on a conflict nothing is committed. + if grep -qE 'E160028|E160024|out of date' "$COMMIT_LOG"; then + echo "::error title=Concurrent SVN commit::Someone else committed to this plugin on WordPress.org in the meantime (maybe a release running at the same time). Nothing was changed. Re-run this workflow once the other run has finished." + fi + exit 1 + fi + + echo "✅ WordPress.org plugin page updated. Changes may take a few minutes (up to hours) to show due to CDN caching." + + - name: Prepare dry run preview + if: inputs.DRY_RUN == true && steps.svn_status.outputs.HAS_CHANGES == 'true' + run: | + set -euo pipefail + + PREVIEW_DIR="${RUNNER_TEMP}/plugin_page_preview" + echo "PREVIEW_DIR=$PREVIEW_DIR" >> "$GITHUB_ENV" + mkdir -p "$PREVIEW_DIR" + + cd "$SVN_REPO_ROOT" + + # The preview holds exactly what would be committed, in its final state. + while IFS= read -r COMMIT_PATH; do + case "$COMMIT_PATH" in + assets) + rsync -r --exclude='.svn' assets/ "$PREVIEW_DIR/assets/" + ;; + trunk/readme.txt) + # trunk is left alone when it holds unreleased changes, so include it only if it changes. + if [ -n "$(svn status trunk/readme.txt)" ]; then + mkdir -p "$PREVIEW_DIR/trunk" + cp trunk/readme.txt "$PREVIEW_DIR/trunk/readme.txt" + fi + ;; + *) + mkdir -p "$PREVIEW_DIR/$(dirname "$COMMIT_PATH")" + cp "$COMMIT_PATH" "$PREVIEW_DIR/$COMMIT_PATH" + ;; + esac + done < "$COMMIT_PATHS_FILE" + + - name: Upload dry run preview as an artifact + if: inputs.DRY_RUN == true && steps.svn_status.outputs.HAS_CHANGES == 'true' + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: ${{ inputs.SVN_PLUGIN_SLUG }}-plugin-page + path: ${{ env.PREVIEW_DIR }} + if-no-files-found: error + compression-level: 1 #Minimal compression - we don't want to waste resources for this From f33cca80953ba8515fc86f897c7cbcd8e80b67bf Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Fri, 23 Oct 2026 17:04:42 +0300 Subject: [PATCH 02/34] Add WordPress.org plugin page workflow docs - document inputs, asset rules, dry run and troubleshooting - link the workflow from README and the release docs - correct the release docs note on readme changes requiring a new tag - suggest excluding the assets directory via .distignore --- README.md | 1 + docs/wordpress-org-plugin-page.md | 217 ++++++++++++++++++++++++++++++ docs/wordpress-org-release.md | 5 +- 3 files changed, 222 insertions(+), 1 deletion(-) create mode 100644 docs/wordpress-org-plugin-page.md diff --git a/README.md b/README.md index 377770187..e15f00673 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ groups here: * End-to-end tests with [Playwright](./docs/test-playwright.md) * [Build and distribute plugin and theme archives](./docs/build-and-distribute.md) * [Release to the WordPress.org plugin directory](./docs/wordpress-org-release.md) +* [Update the WordPress.org plugin page (readme and assets)](./docs/wordpress-org-plugin-page.md) * [Quality Insights Toolkit (QIT) for WooCommerce](./docs/woo-qit.md) * [Deployments with Deployer](./docs/deploy-deployer.md) diff --git a/docs/wordpress-org-plugin-page.md b/docs/wordpress-org-plugin-page.md new file mode 100644 index 000000000..b93ea9322 --- /dev/null +++ b/docs/wordpress-org-plugin-page.md @@ -0,0 +1,217 @@ +# WordPress.org Plugin Page + +This reusable workflow updates what the [WordPress.org plugin directory](https://wordpress.org/plugins/) shows on a plugin's page (the `readme.txt` and the banners, icons, screenshots, and Playground blueprints) **without releasing a new plugin version**. + +Use it for changes like: + +- adding or removing promotional links in `readme.txt` +- bumping `Tested up to` after verifying compatibility with a new WordPress release +- fixing typos, FAQ entries, or screenshot captions +- temporarily swapping a banner (e.g. for a campaign) and reverting it later +- refreshing screenshots or adding a Playground preview blueprint + +To ship new plugin code, use [WordPress.org Release](./wordpress-org-release.md) instead. That workflow also publishes `readme.txt` as part of every release, so both workflows keep the plugin page in sync with Git. + +To achieve that, this workflow: + +1. Checks out the Git repository at `GIT_REF` +2. When `SYNC_README` is enabled, reads the `Stable tag` from `readme.txt` +3. When `SYNC_ASSETS` is enabled, validates every file in `ASSETS_DIR` (names, size limits, real image format and dimensions, blueprint JSON), and fails if the directory is missing or empty, or contains symlinks or unsupported subdirectories +4. Checks out only the needed parts of the WordPress.org SVN repository: `trunk/readme.txt`, the list of tags, the readme of the stable tag, and `/assets`. Plugin code is never fetched +5. Verifies that the `Stable tag` in Git equals the `Stable tag` in SVN trunk and that this tag exists +6. Copies `readme.txt` into `tags//` (which is what WordPress.org renders) and into `trunk/`. The trunk copy is skipped with a warning if trunk contains unreleased changes, see [Trunk previews](#trunk-previews). A warning is also shown if `Requires at least` or `Requires PHP` changes, because that changes the compatibility info of the published version +7. Mirrors `ASSETS_DIR` to SVN `/assets` via `rsync --delete`, so files removed from Git are removed from WordPress.org as well, and sets the correct `svn:mime-type` on every asset +8. Fails if anything would change that the enabled options don't allow: `trunk/readme.txt` and `tags//readme.txt` with `SYNC_README`, and recognized asset files in `/assets` with `SYNC_ASSETS` +9. Shows the `svn status`, the removed files, and the `readme.txt` diff in the log and in the job summary on the run page +10. Commits all changes in a single SVN commit (or uploads them as an artifact in `DRY_RUN` mode). If nothing changed, the workflow ends successfully without committing + +> [!IMPORTANT] +> This workflow never creates tags, never changes the `Stable tag`, and never touches plugin code. Changing the `Stable tag` means publishing a different version, which is a release. + +> [!NOTE] +> WordPress.org renders the plugin page from the `readme.txt` in the tag that `Stable tag` points to, not from trunk. The WordPress.org [plugin developer FAQ](https://developer.wordpress.org/plugins/wordpress-org/plugin-developer-faq/#do-i-need-to-release-a-new-version-of-my-plugin-every-time-i-update-the-readme) explicitly allows cosmetic readme and asset changes without a new release, as long as both trunk and the tag are updated. + +> [!NOTE] +> Assets are served through a CDN and cached heavily. Changes can take a few minutes, and under high load up to several hours, to show up on the plugin page. + +## Simple usage example + +This workflow cannot be triggered directly. Create a workflow file in your plugin's repository that calls it via `uses:`, as shown below. + +```yml +name: Update WordPress.org plugin page +on: + workflow_dispatch: + inputs: + GIT_REF: + description: 'Git tag or branch to read readme.txt and assets from' + required: true + SYNC_README: + description: 'Update readme.txt' + type: boolean + default: true + SYNC_ASSETS: + description: 'Update banners, icons, screenshots, and blueprints' + type: boolean + default: true + DRY_RUN: + description: 'Upload the changes as an artifact instead of committing to SVN' + type: boolean + default: true +jobs: + update-plugin-page: + uses: inpsyde/reusable-workflows/.github/workflows/wordpress-org-plugin-page.yml@main + with: + SVN_PLUGIN_SLUG: my-plugin + GIT_REF: ${{ inputs.GIT_REF }} + SYNC_README: ${{ inputs.SYNC_README }} + SYNC_ASSETS: ${{ inputs.SYNC_ASSETS }} + DRY_RUN: ${{ inputs.DRY_RUN }} + secrets: + SVN_USERNAME: ${{ secrets.SVN_USERNAME }} + SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} +``` + +`GIT_REF` should point to a ref whose `readme.txt` describes the **currently published** version, such as the Git tag of the latest release plus the cosmetic change, or the branch that holds the released state. A development branch whose `readme.txt` already carries the next version's `Stable tag` fails the Stable tag check by design. + +> [!IMPORTANT] +> `DRY_RUN` defaults to `true`, so a caller that doesn't pass it only previews the changes. Set `DRY_RUN: false` to actually update the plugin page. + +## Update assets automatically on merge + +Because the assets directory is validated and mirrored, it can be synced whenever it changes on the main branch: + +```yml +name: Update WordPress.org assets +on: + push: + branches: [main] + paths: ['.wordpress-org/**'] +jobs: + update-assets: + uses: inpsyde/reusable-workflows/.github/workflows/wordpress-org-plugin-page.yml@main + with: + SVN_PLUGIN_SLUG: my-plugin + GIT_REF: ${{ github.sha }} + SYNC_README: false + DRY_RUN: false + secrets: + SVN_USERNAME: ${{ secrets.SVN_USERNAME }} + SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} +``` + +> [!NOTE] +> Only automate readme syncing if the branch's `readme.txt` always describes the published version. Otherwise, keep `SYNC_README: false` for automated runs and update the readme through a manually triggered run. + +## Advanced usage: requiring manual approval + +To require approval before the plugin page is updated, add an `environment:` key to the calling job and configure protection rules (required reviewers, wait timers, etc.) for that environment in your repository settings under **Settings → Environments**. + +```yml +jobs: + update-plugin-page: + environment: wordpress-org # enforces protection rules configured in repository settings + uses: inpsyde/reusable-workflows/.github/workflows/wordpress-org-plugin-page.yml@main + with: + SVN_PLUGIN_SLUG: my-plugin + GIT_REF: ${{ inputs.GIT_REF }} + DRY_RUN: false + secrets: + SVN_USERNAME: ${{ secrets.SVN_USERNAME }} + SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} +``` + +> [!NOTE] +> The `environment:` key alone does nothing: protection rules must be explicitly configured in repository settings. An environment with no rules configured provides no approval gate. + +> [!WARNING] +> An environment's **deployment branch** rule restricts the ref the *calling* workflow runs from, not `GIT_REF`. With `GIT_REF` as a free-text input, anyone allowed to run the workflow can publish the readme and assets from any branch, regardless of the environment rule. If you rely on branch rules, pass `${{ github.sha }}` or `${{ github.ref_name }}` as `GIT_REF`, or offer a `choice` input instead. + +## Adopting the workflow + +Assets are mirrored, so the assets directory in Git must contain **every** asset that should stay on WordPress.org. Before the first run, import the current assets from SVN: + +```shell +svn export https://plugins.svn.wordpress.org/my-plugin/assets .wordpress-org +``` + +Then: + +1. Commit the `.wordpress-org` directory. Don't store it in Git LFS, see [Supported asset files](#supported-asset-files). +2. Add `.wordpress-org/` to `.distignore` so the assets don't end up in the plugin package or in SVN trunk during releases. +3. Run the workflow with `DRY_RUN: true`. The SVN changes in the job summary should list **no content changes** in `/assets`. Property-only changes (` M`) are expected where existing assets lack the correct `svn:mime-type`. +4. Fix any files the validation rejects. Some are ignored by WordPress.org (e.g. `icon_128x128.png`), others are only rejected by this workflow's stricter rules (lowercase names, a raster fallback for `icon.svg`). + +## Trunk previews + +If SVN `trunk/readme.txt` differs from `tags//readme.txt` before the sync, trunk holds unreleased changes, for example a preview published with the release workflow's `UPDATE_TRUNK_ONLY` mode. Overwriting it would silently revert those changes, so in that case the workflow only updates the tag's `readme.txt` and emits a warning. Make sure the same change is part of the upcoming release, so that it isn't lost when the next version is published. + +## Supported asset files + +Any file with a name WordPress.org would ignore fails the validation. On top of the WordPress.org rules, this workflow requires: + +- lowercase file names (except the region part of a locale, e.g. `es_ES`) +- a raster fallback for `icon.svg` +- at most 10 blueprints (WordPress.org would silently import only the first 10) +- banners and raster icons with exactly the dimensions their name says, and raster files in the format their extension says +- regular files only: symlinks and subdirectories other than `blueprints/` are rejected + +Hidden files like `.gitkeep` are ignored. + +| Type | File names | Formats | Max size | +|---|---|---|---| +| Banner | `banner-772x250`, `banner-1544x500` | png, jpg, jpeg, gif | 4 MB | +| Icon | `icon-128x128`, `icon-256x256`, `icon.svg` | png, jpg, jpeg, gif (`icon.svg` requires one of them as fallback) | 1 MB | +| Screenshot | `screenshot-1`, `screenshot-2`, … | png, jpg, jpeg, gif | 10 MB | +| Blueprint | `blueprints/blueprint.json`, `blueprints/blueprint-.json` | JSON object or array, max. 10 files | 100 KB | + +Banners, icons, and screenshots can be localized with an `-rtl` and/or a locale suffix, e.g. `banner-772x250-rtl.png`, `banner-1544x500-de.png`, or `screenshot-1-es_ES.png`. Screenshot captions come from the `== Screenshots ==` section of `readme.txt`. See [Plugin Assets](https://developer.wordpress.org/plugins/wordpress-org/plugin-assets/) for details. + +> [!WARNING] +> Git LFS is not supported. `actions/checkout` doesn't fetch LFS files by default, so the workflow would see small pointer files instead of images. The format check rejects them. + +> [!NOTE] +> A blueprint enables the "Live Preview" button for plugin committers only. To show it to everyone, a committer must set the preview to public in the plugin's **Advanced View** on WordPress.org. See [Previews and Blueprints](https://developer.wordpress.org/plugins/wordpress-org/previews-and-blueprints/). + +## Configuration parameters + +### Inputs + +| Name | Required | Default | Description | +|---|---|---|---| +| `SVN_PLUGIN_SLUG` | yes | — | WordPress.org plugin slug (e.g. `my-plugin`) | +| `GIT_REF` | yes | — | Git ref to read `readme.txt` and the assets directory from (tag, branch, or commit SHA) | +| `SYNC_README` | no | `true` | Update `readme.txt` in SVN trunk and in the tag referenced by `Stable tag` | +| `SYNC_ASSETS` | no | `true` | Mirror `ASSETS_DIR` to the SVN `/assets` directory | +| `ASSETS_DIR` | no | `.wordpress-org` | Directory in the Git repository holding the WordPress.org assets | +| `DRY_RUN` | no | `true` | Upload the files that would be committed as an artifact instead of committing to SVN | + +At least one of `SYNC_README` and `SYNC_ASSETS` must be enabled. + +### Secrets + +| Name | Required | Description | +|---|---|---| +| `SVN_USERNAME` | yes | WordPress.org SVN username | +| `SVN_PASSWORD` | yes | WordPress.org SVN password | + +> [!NOTE] +> WordPress.org SVN does not support SSH keys or tokens. The `SVN_USERNAME` and `SVN_PASSWORD` secrets are the only supported authentication method. + +## Dry run + +With `DRY_RUN: true`, nothing is committed. The job summary on the run page shows every file that would be added (`A`), deleted (`D`), modified (`M`), or have its properties changed (` M`), lists removed files separately, and shows the `readme.txt` diff. + +If anything would change, an artifact named `-plugin-page` is uploaded. It contains exactly what would be committed, in its final state: + +- `tags//readme.txt` (with `SYNC_README`) +- `trunk/readme.txt`, only if it would change (see [Trunk previews](#trunk-previews)) +- `assets/`: the complete assets directory (with `SYNC_ASSETS`) + +If nothing would change, no artifact is uploaded and the job summary says that the plugin page is already up to date. + +## Troubleshooting + +The workflow is idempotent: changes are committed in a single atomic SVN commit, and a run without changes succeeds. If a run fails, even in the commit step because of a network error, **Re-run failed jobs** is always safe. The re-run either commits the changes or reports that the plugin page is already up to date, so there is no need to fix anything in SVN by hand. + +If someone else commits to the plugin's SVN repository while the workflow runs (e.g. a release running at the same time), the commit fails with an `out of date` error and nothing is changed. Re-run the workflow once the other run has finished. diff --git a/docs/wordpress-org-release.md b/docs/wordpress-org-release.md index 87d852831..1ef5d79e2 100644 --- a/docs/wordpress-org-release.md +++ b/docs/wordpress-org-release.md @@ -131,7 +131,7 @@ To preview trunk before publishing, run the workflow twice with the same `PLUGIN > The trunk-only check exists because [WordPress.org serves the plugin from trunk instead of a tag when `Stable tag` points to a tag that doesn't exist](https://developer.wordpress.org/plugins/wordpress-org/how-your-readme-txt-works/#how-the-readme-is-parsed) — without it, a trunk-only sync could accidentally push the in-progress release out as "stable" to regular users. > [!NOTE] -> WordPress.org reads `readme.txt` from the tag that `Stable tag` points to, not from trunk. Updating `readme.txt` in trunk alone will not update the plugin page — a new tag must be created. +> WordPress.org reads `readme.txt` from the tag that `Stable tag` points to, not from trunk. Updating `readme.txt` in trunk alone will not update the plugin page. To change the plugin page (readme, banners, icons, screenshots) without releasing a new version, use [WordPress.org Plugin Page](./wordpress-org-plugin-page.md). ## Configuration parameters @@ -165,3 +165,6 @@ The following files are always excluded from the SVN sync, regardless of `.disti - `.distignore` itself Additional exclusions can be specified via a `.distignore` file in the repository root (same format used by `wp dist-archive`). + +> [!TIP] +> If the repository keeps its WordPress.org assets in Git for the [WordPress.org Plugin Page](./wordpress-org-plugin-page.md) workflow (by default in `.wordpress-org/`), add that directory to `.distignore` so it isn't synced to trunk. From aae6a2e13dd170128da866fd59d270a0ff4c3c73 Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Fri, 23 Oct 2026 17:29:32 +0300 Subject: [PATCH 03/34] Add Release Confirmation notice to plugin page workflow - show a notice when the stable tag's readme.txt changes - document that a tag change reopens the release for confirmation - note that asset-only runs are not affected --- .github/workflows/wordpress-org-plugin-page.yml | 6 ++++++ docs/wordpress-org-plugin-page.md | 17 ++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/wordpress-org-plugin-page.yml b/.github/workflows/wordpress-org-plugin-page.yml index 5c4d9f8b1..09a20bb94 100644 --- a/.github/workflows/wordpress-org-plugin-page.yml +++ b/.github/workflows/wordpress-org-plugin-page.yml @@ -386,6 +386,12 @@ jobs: TRUNK_IN_SYNC=false fi + # WordPress.org treats any change to a released tag as a modified release, + # and with Release Confirmation enabled that release must be confirmed again. + if ! cmp -s "$GIT_README" "$TAG_README"; then + echo "::notice title=Release Confirmation::If this plugin has Release Confirmation enabled on WordPress.org, updating $TAG_README reopens release $STABLE_TAG for confirmation. All committers get an email, and the plugin page updates only after the release is confirmed again." + fi + # The plugin page is rendered from the readme.txt of the Stable tag. cp "$GIT_README" "$TAG_README" echo "✅ Updated $TAG_README" diff --git a/docs/wordpress-org-plugin-page.md b/docs/wordpress-org-plugin-page.md index b93ea9322..e67c2bcb7 100644 --- a/docs/wordpress-org-plugin-page.md +++ b/docs/wordpress-org-plugin-page.md @@ -19,7 +19,7 @@ To achieve that, this workflow: 3. When `SYNC_ASSETS` is enabled, validates every file in `ASSETS_DIR` (names, size limits, real image format and dimensions, blueprint JSON), and fails if the directory is missing or empty, or contains symlinks or unsupported subdirectories 4. Checks out only the needed parts of the WordPress.org SVN repository: `trunk/readme.txt`, the list of tags, the readme of the stable tag, and `/assets`. Plugin code is never fetched 5. Verifies that the `Stable tag` in Git equals the `Stable tag` in SVN trunk and that this tag exists -6. Copies `readme.txt` into `tags//` (which is what WordPress.org renders) and into `trunk/`. The trunk copy is skipped with a warning if trunk contains unreleased changes, see [Trunk previews](#trunk-previews). A warning is also shown if `Requires at least` or `Requires PHP` changes, because that changes the compatibility info of the published version +6. Copies `readme.txt` into `tags//` (which is what WordPress.org renders) and into `trunk/`. The trunk copy is skipped with a warning if trunk contains unreleased changes, see [Trunk previews](#trunk-previews). A warning is also shown if `Requires at least` or `Requires PHP` changes, because that changes the compatibility info of the published version. A notice reminds about [Release Confirmation](#release-confirmation) whenever the tag's `readme.txt` changes 7. Mirrors `ASSETS_DIR` to SVN `/assets` via `rsync --delete`, so files removed from Git are removed from WordPress.org as well, and sets the correct `svn:mime-type` on every asset 8. Fails if anything would change that the enabled options don't allow: `trunk/readme.txt` and `tags//readme.txt` with `SYNC_README`, and recognized asset files in `/assets` with `SYNC_ASSETS` 9. Shows the `svn status`, the removed files, and the `readme.txt` diff in the log and in the job summary on the run page @@ -146,6 +146,21 @@ Then: If SVN `trunk/readme.txt` differs from `tags//readme.txt` before the sync, trunk holds unreleased changes, for example a preview published with the release workflow's `UPDATE_TRUNK_ONLY` mode. Overwriting it would silently revert those changes, so in that case the workflow only updates the tag's `readme.txt` and emits a warning. Make sure the same change is part of the upcoming release, so that it isn't lost when the next version is published. +## Release Confirmation + +[Release Confirmation](https://developer.wordpress.org/plugins/wordpress-org/release-confirmation-emails/) is an opt-in WordPress.org feature that requires committers to confirm every release by email. Plugin committers can check whether it is enabled for the plugin on WordPress.org. + +With Release Confirmation enabled, WordPress.org treats any commit to an already released tag as a modified release, even one that only changes `readme.txt`. Updating `tags//readme.txt` therefore: + +- reopens that release for confirmation and sends the confirmation email to all committers again +- restarts the release cooldown +- keeps the plugin page from updating until the release is confirmed again + +Asset-only runs (`SYNC_README: false`) don't touch any tag and are not affected. + +> [!NOTE] +> The handbook page still says that released tags can't be altered at all, including the readme. The plugin directory importer [reopens the modified release for confirmation](https://github.com/WordPress/wordpress.org/commit/8d1727f0e331ccfebce432bdfcf4c30db16e2803) instead. + ## Supported asset files Any file with a name WordPress.org would ignore fails the validation. On top of the WordPress.org rules, this workflow requires: From 875a85984b3124898a2d80df2a7f691240001028 Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Fri, 23 Oct 2026 18:04:40 +0300 Subject: [PATCH 04/34] Mark readme sync with Release Confirmation as unsupported - quote the handbook: released tags can't be altered - describe the importer behavior as undocumented, use at own risk - mention that the release ZIP may not be rebuilt --- docs/wordpress-org-plugin-page.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/wordpress-org-plugin-page.md b/docs/wordpress-org-plugin-page.md index e67c2bcb7..71a9b8c3d 100644 --- a/docs/wordpress-org-plugin-page.md +++ b/docs/wordpress-org-plugin-page.md @@ -150,16 +150,18 @@ If SVN `trunk/readme.txt` differs from `tags//readme.txt` before the [Release Confirmation](https://developer.wordpress.org/plugins/wordpress-org/release-confirmation-emails/) is an opt-in WordPress.org feature that requires committers to confirm every release by email. Plugin committers can check whether it is enabled for the plugin on WordPress.org. -With Release Confirmation enabled, WordPress.org treats any commit to an already released tag as a modified release, even one that only changes `readme.txt`. Updating `tags//readme.txt` therefore: +> [!WARNING] +> For plugins with Release Confirmation enabled, the handbook explicitly states that released tags can't be altered, including the readme (e.g. for `Tested up to`). Updating `readme.txt` with this workflow is therefore **not officially supported** for these plugins. Use it at your own risk, or keep `SYNC_README: false` and ship readme changes with the next release. + +Judging by the plugin directory importer's code, the scenario appears to be handled: WordPress.org treats any commit to an already released tag as a [modified release](https://github.com/WordPress/wordpress.org/commit/8d1727f0e331ccfebce432bdfcf4c30db16e2803), even one that only changes `readme.txt`. Updating `tags//readme.txt` then: - reopens that release for confirmation and sends the confirmation email to all committers again - restarts the release cooldown - keeps the plugin page from updating until the release is confirmed again -Asset-only runs (`SYNC_README: false`) don't touch any tag and are not affected. +This behavior isn't documented and may change. It's also unclear whether the downloadable ZIP of the release is rebuilt with the new `readme.txt`. -> [!NOTE] -> The handbook page still says that released tags can't be altered at all, including the readme. The plugin directory importer [reopens the modified release for confirmation](https://github.com/WordPress/wordpress.org/commit/8d1727f0e331ccfebce432bdfcf4c30db16e2803) instead. +Asset-only runs (`SYNC_README: false`) don't touch any tag and are not affected. ## Supported asset files From 5f6631624f456519cad02088afabcec7bb45ea4d Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Fri, 23 Oct 2026 20:04:33 +0300 Subject: [PATCH 05/34] Accept any Stable tag format allowed by WordPress.org - allow the same characters as the WordPress.org readme parser - accept versions like 1.2.3.4, 1.0.0-rc1, v1.2 - reject '..' since the value is used in SVN paths --- .github/workflows/wordpress-org-plugin-page.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/wordpress-org-plugin-page.yml b/.github/workflows/wordpress-org-plugin-page.yml index 09a20bb94..606c63c7a 100644 --- a/.github/workflows/wordpress-org-plugin-page.yml +++ b/.github/workflows/wordpress-org-plugin-page.yml @@ -141,10 +141,11 @@ jobs: exit 1 fi - # This workflow never creates versions, it only has to find the existing tag, - # so any numeric dotted version with 1-4 parts is accepted here. This intentionally - # differs from the strict X.Y.Z check of wordpress-org-release, which creates new tags. - if [[ ! "$STABLE_TAG" =~ ^[0-9]+(\.[0-9]+){0,3}$ ]]; then + # This workflow never creates versions, it only has to find the existing tag, so it accepts + # the same characters WordPress.org allows in a Stable tag (e.g. 1.2.3.4, 1.0.0-rc1, v1.2). + # This intentionally differs from the strict X.Y.Z check of wordpress-org-release, which creates new tags. + # The value is used in SVN paths, so '..' is rejected; the tag's existence is verified against SVN later. + if [[ ! "$STABLE_TAG" =~ ^[A-Za-z0-9][A-Za-z0-9_.-]*$ ]] || [[ "$STABLE_TAG" == *..* ]]; then echo "❌ Unexpected 'Stable tag' format in readme.txt: $STABLE_TAG" exit 1 fi From e4eebc765c2c78d45b2ed67058ba4e20547d057a Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Thu, 29 Oct 2026 10:29:25 +0200 Subject: [PATCH 06/34] Clarify which asset names must be lowercase - the lowercase rule applies to banners, icons, and screenshots only - the locale region and blueprint names may contain uppercase letters --- .github/workflows/wordpress-org-plugin-page.yml | 5 +++-- docs/wordpress-org-plugin-page.md | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/wordpress-org-plugin-page.yml b/.github/workflows/wordpress-org-plugin-page.yml index 606c63c7a..e2c8ba0b9 100644 --- a/.github/workflows/wordpress-org-plugin-page.yml +++ b/.github/workflows/wordpress-org-plugin-page.yml @@ -54,8 +54,9 @@ jobs: contents: read env: # Filename rules of the WordPress.org plugin directory importer, restricted to the documented - # banner and icon resolutions and to lowercase names (a rule of this workflow, not of WordPress.org). - # Shared by the asset validation and the scope guard, so they can't drift apart. + # banner and icon resolutions. Banners, icons, and screenshots must be lowercase (a rule of this + # workflow, not of WordPress.org), except the locale's region (e.g. es_ES). Blueprint names follow + # the importer as is. Shared by the asset validation and the scope guard, so they can't drift apart. # Locale suffix: (-rtl)?(-[a-z]{2,3}(_[A-Z]{2})?(_[a-z0-9]+)?)? BANNER_RE: '^banner-(772x250|1544x500)(-rtl)?(-[a-z]{2,3}(_[A-Z]{2})?(_[a-z0-9]+)?)?\.(png|jpg|jpeg|gif)$' ICON_RE: '^icon-(128x128|256x256)(-rtl)?(-[a-z]{2,3}(_[A-Z]{2})?(_[a-z0-9]+)?)?\.(png|jpg|jpeg|gif)$' diff --git a/docs/wordpress-org-plugin-page.md b/docs/wordpress-org-plugin-page.md index 71a9b8c3d..a4a5373f8 100644 --- a/docs/wordpress-org-plugin-page.md +++ b/docs/wordpress-org-plugin-page.md @@ -167,7 +167,7 @@ Asset-only runs (`SYNC_README: false`) don't touch any tag and are not affected. Any file with a name WordPress.org would ignore fails the validation. On top of the WordPress.org rules, this workflow requires: -- lowercase file names (except the region part of a locale, e.g. `es_ES`) +- lowercase banner, icon, and screenshot file names (except the region part of a locale, e.g. `es_ES`) - a raster fallback for `icon.svg` - at most 10 blueprints (WordPress.org would silently import only the first 10) - banners and raster icons with exactly the dimensions their name says, and raster files in the format their extension says From f63f5ff3cc643e93feaaf8ca5c8d9cee89216dde Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Thu, 29 Oct 2026 10:32:46 +0200 Subject: [PATCH 07/34] Match asset names case-insensitively like WordPress.org - drop the lowercase rule for banners, icons, and screenshots - keep blueprints and icon.svg case-sensitive, like the importer and template - reject names that differ only in case - map uppercase extensions to the correct format and mime type --- .../workflows/wordpress-org-plugin-page.yml | 43 ++++++++++++------- docs/wordpress-org-plugin-page.md | 3 +- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/.github/workflows/wordpress-org-plugin-page.yml b/.github/workflows/wordpress-org-plugin-page.yml index e2c8ba0b9..7e6ea06bc 100644 --- a/.github/workflows/wordpress-org-plugin-page.yml +++ b/.github/workflows/wordpress-org-plugin-page.yml @@ -54,13 +54,13 @@ jobs: contents: read env: # Filename rules of the WordPress.org plugin directory importer, restricted to the documented - # banner and icon resolutions. Banners, icons, and screenshots must be lowercase (a rule of this - # workflow, not of WordPress.org), except the locale's region (e.g. es_ES). Blueprint names follow - # the importer as is. Shared by the asset validation and the scope guard, so they can't drift apart. - # Locale suffix: (-rtl)?(-[a-z]{2,3}(_[A-Z]{2})?(_[a-z0-9]+)?)? - BANNER_RE: '^banner-(772x250|1544x500)(-rtl)?(-[a-z]{2,3}(_[A-Z]{2})?(_[a-z0-9]+)?)?\.(png|jpg|jpeg|gif)$' - ICON_RE: '^icon-(128x128|256x256)(-rtl)?(-[a-z]{2,3}(_[A-Z]{2})?(_[a-z0-9]+)?)?\.(png|jpg|jpeg|gif)$' - SCREENSHOT_RE: '^screenshot-[0-9]+(-rtl)?(-[a-z]{2,3}(_[A-Z]{2})?(_[a-z0-9]+)?)?\.(png|jpg|jpeg|gif)$' + # banner and icon resolutions. Shared by the asset validation and the scope guard, so they can't drift apart. + # The importer matches banners, icons, and screenshots case-insensitively, so these three are + # matched against the lowercased name. Blueprints are matched case-sensitively, like the importer does. + # Locale suffix: (-rtl)?(-[a-z]{2,3}(_[a-z]{2})?(_[a-z0-9]+)?)? + BANNER_RE: '^banner-(772x250|1544x500)(-rtl)?(-[a-z]{2,3}(_[a-z]{2})?(_[a-z0-9]+)?)?\.(png|jpg|jpeg|gif)$' + ICON_RE: '^icon-(128x128|256x256)(-rtl)?(-[a-z]{2,3}(_[a-z]{2})?(_[a-z0-9]+)?)?\.(png|jpg|jpeg|gif)$' + SCREENSHOT_RE: '^screenshot-[0-9]+(-rtl)?(-[a-z]{2,3}(_[a-z]{2})?(_[a-z0-9]+)?)?\.(png|jpg|jpeg|gif)$' BLUEPRINT_RE: '^blueprints/blueprint[-A-Za-z0-9_]*\.json$' steps: - name: Install required tools @@ -195,24 +195,34 @@ jobs: HAS_RASTER_ICON=0 HAS_SVG_ICON=0 BLUEPRINT_COUNT=0 + declare -A SEEN_NAMES=() for FILE in "${FILES[@]}"; do SIZE=$(stat -c %s "$ASSETS_DIR/$FILE") + LOWER="${FILE,,}" # Banners and raster icons must have the dimensions their name says, # WordPress.org trusts the name and would render a different size distorted. EXPECTED_DIMENSIONS="" - if [[ "$FILE" =~ $BANNER_RE ]]; then + # The importer ignores case, so two names differing only in case would be the same asset. + if [ -n "${SEEN_NAMES[$LOWER]:-}" ]; then + echo "❌ $FILE and ${SEEN_NAMES[$LOWER]} differ only in case" + ERRORS=1 + continue + fi + SEEN_NAMES[$LOWER]="$FILE" + + if [[ "$LOWER" =~ $BANNER_RE ]]; then LIMIT=$((4 * 1024 * 1024)) EXPECTED_DIMENSIONS="${BASH_REMATCH[1]}" - elif [[ "$FILE" =~ $ICON_RE ]]; then + elif [[ "$LOWER" =~ $ICON_RE ]]; then LIMIT=$((1 * 1024 * 1024)) EXPECTED_DIMENSIONS="${BASH_REMATCH[1]}" HAS_RASTER_ICON=1 elif [ "$FILE" = "icon.svg" ]; then LIMIT=$((1 * 1024 * 1024)) HAS_SVG_ICON=1 - elif [[ "$FILE" =~ $SCREENSHOT_RE ]]; then + elif [[ "$LOWER" =~ $SCREENSHOT_RE ]]; then LIMIT=$((10 * 1024 * 1024)) elif [[ "$FILE" =~ $BLUEPRINT_RE ]]; then LIMIT=$((100 * 1024)) @@ -223,9 +233,9 @@ jobs: ERRORS=1 fi else - LOWER=$(tr '[:upper:]' '[:lower:]' <<< "$FILE") - if [[ "$LOWER" =~ $BANNER_RE ]] || [[ "$LOWER" =~ $ICON_RE ]] || [[ "$LOWER" =~ $SCREENSHOT_RE ]]; then - echo "❌ $FILE must be lowercase (required by this workflow)" + # The importer accepts any case for .svg, but the plugin page only displays icon.svg. + if [ "$LOWER" = "icon.svg" ]; then + echo "❌ $FILE must be named exactly icon.svg (WordPress.org only displays icon.svg)" else echo "❌ $FILE is not a recognized WordPress.org asset (WordPress.org would ignore it)" fi @@ -244,7 +254,7 @@ jobs: # The real format must match the extension. This also catches Git LFS pointer files, # which actions/checkout fetches instead of the images unless LFS is enabled. - case "$FILE" in + case "$LOWER" in *.png) EXPECTED_FORMAT="PNG" ;; *.jpg|*.jpeg) EXPECTED_FORMAT="JPEG" ;; *.gif) EXPECTED_FORMAT="GIF" ;; @@ -434,7 +444,7 @@ jobs: # Without a correct svn:mime-type, browsers download assets instead of displaying them. # 'svn add' marks binaries as application/octet-stream, so this also fixes newly added files. find assets -type f | while IFS= read -r file; do - case "$file" in + case "${file,,}" in *.png) MIME_TYPE="image/png" ;; *.jpg|*.jpeg) MIME_TYPE="image/jpeg" ;; *.gif) MIME_TYPE="image/gif" ;; @@ -478,7 +488,8 @@ jobs: [ "$STATUS" = "D" ] && return 0 local ASSET="${FILE#assets/}" [ "$ASSET" = "icon.svg" ] && return 0 - [[ "$ASSET" =~ $BANNER_RE || "$ASSET" =~ $ICON_RE || "$ASSET" =~ $SCREENSHOT_RE || "$ASSET" =~ $BLUEPRINT_RE ]] && return 0 + local LOWER="${ASSET,,}" + [[ "$LOWER" =~ $BANNER_RE || "$LOWER" =~ $ICON_RE || "$LOWER" =~ $SCREENSHOT_RE || "$ASSET" =~ $BLUEPRINT_RE ]] && return 0 ;; esac fi diff --git a/docs/wordpress-org-plugin-page.md b/docs/wordpress-org-plugin-page.md index a4a5373f8..b5f75999e 100644 --- a/docs/wordpress-org-plugin-page.md +++ b/docs/wordpress-org-plugin-page.md @@ -140,7 +140,7 @@ Then: 1. Commit the `.wordpress-org` directory. Don't store it in Git LFS, see [Supported asset files](#supported-asset-files). 2. Add `.wordpress-org/` to `.distignore` so the assets don't end up in the plugin package or in SVN trunk during releases. 3. Run the workflow with `DRY_RUN: true`. The SVN changes in the job summary should list **no content changes** in `/assets`. Property-only changes (` M`) are expected where existing assets lack the correct `svn:mime-type`. -4. Fix any files the validation rejects. Some are ignored by WordPress.org (e.g. `icon_128x128.png`), others are only rejected by this workflow's stricter rules (lowercase names, a raster fallback for `icon.svg`). +4. Fix any files the validation rejects. Some are ignored by WordPress.org (e.g. `icon_128x128.png`), others are only rejected by this workflow's stricter rules (e.g. a raster fallback for `icon.svg`). ## Trunk previews @@ -167,7 +167,6 @@ Asset-only runs (`SYNC_README: false`) don't touch any tag and are not affected. Any file with a name WordPress.org would ignore fails the validation. On top of the WordPress.org rules, this workflow requires: -- lowercase banner, icon, and screenshot file names (except the region part of a locale, e.g. `es_ES`) - a raster fallback for `icon.svg` - at most 10 blueprints (WordPress.org would silently import only the first 10) - banners and raster icons with exactly the dimensions their name says, and raster files in the format their extension says From 70c07061effc81943c69bb5053e5fb92977ea1cc Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Thu, 29 Oct 2026 10:43:22 +0200 Subject: [PATCH 08/34] Explain why Requires header changes trigger a warning - WordPress blocks installs and updates based on these values - the main plugin file's headers take precedence over readme.txt --- .github/workflows/wordpress-org-plugin-page.yml | 6 ++++-- docs/wordpress-org-plugin-page.md | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/wordpress-org-plugin-page.yml b/.github/workflows/wordpress-org-plugin-page.yml index 7e6ea06bc..64b93a180 100644 --- a/.github/workflows/wordpress-org-plugin-page.yml +++ b/.github/workflows/wordpress-org-plugin-page.yml @@ -380,12 +380,14 @@ jobs: | sed -E 's/^[^:]*:[[:space:]]*//; s/[[:space:]]+$//' | tr -d '\r' || true } - # These headers change the compatibility info of the published version, which is more than cosmetic. + # Unlike the rest of readme.txt, these headers aren't just displayed: unless the main plugin file + # declares them, WordPress.org publishes them as the version's requirements, and WordPress blocks + # installing or updating to that version on sites that don't meet them. for HEADER in "Requires at least" "Requires PHP"; do OLD_VALUE=$(readme_header "$HEADER" "$TAG_README") NEW_VALUE=$(readme_header "$HEADER" "$GIT_README") if [ "$OLD_VALUE" != "$NEW_VALUE" ]; then - echo "::warning title=$HEADER changed::'$HEADER' changes from '${OLD_VALUE:-(none)}' to '${NEW_VALUE:-(none)}' for the already published version $STABLE_TAG. Make sure version $STABLE_TAG really has these requirements." + echo "::warning title=$HEADER changed::'$HEADER' changes from '${OLD_VALUE:-(none)}' to '${NEW_VALUE:-(none)}' for the already published version $STABLE_TAG. Unless the main plugin file declares it, WordPress uses this value to block installs and updates on sites that don't meet it." fi done diff --git a/docs/wordpress-org-plugin-page.md b/docs/wordpress-org-plugin-page.md index b5f75999e..7d2ae4854 100644 --- a/docs/wordpress-org-plugin-page.md +++ b/docs/wordpress-org-plugin-page.md @@ -19,7 +19,7 @@ To achieve that, this workflow: 3. When `SYNC_ASSETS` is enabled, validates every file in `ASSETS_DIR` (names, size limits, real image format and dimensions, blueprint JSON), and fails if the directory is missing or empty, or contains symlinks or unsupported subdirectories 4. Checks out only the needed parts of the WordPress.org SVN repository: `trunk/readme.txt`, the list of tags, the readme of the stable tag, and `/assets`. Plugin code is never fetched 5. Verifies that the `Stable tag` in Git equals the `Stable tag` in SVN trunk and that this tag exists -6. Copies `readme.txt` into `tags//` (which is what WordPress.org renders) and into `trunk/`. The trunk copy is skipped with a warning if trunk contains unreleased changes, see [Trunk previews](#trunk-previews). A warning is also shown if `Requires at least` or `Requires PHP` changes, because that changes the compatibility info of the published version. A notice reminds about [Release Confirmation](#release-confirmation) whenever the tag's `readme.txt` changes +6. Copies `readme.txt` into `tags//` (which is what WordPress.org renders) and into `trunk/`. The trunk copy is skipped with a warning if trunk contains unreleased changes, see [Trunk previews](#trunk-previews). A warning is also shown if `Requires at least` or `Requires PHP` changes: unless the main plugin file declares them, WordPress uses these values to block installs and updates of the published version on sites that don't meet them. A notice reminds about [Release Confirmation](#release-confirmation) whenever the tag's `readme.txt` changes 7. Mirrors `ASSETS_DIR` to SVN `/assets` via `rsync --delete`, so files removed from Git are removed from WordPress.org as well, and sets the correct `svn:mime-type` on every asset 8. Fails if anything would change that the enabled options don't allow: `trunk/readme.txt` and `tags//readme.txt` with `SYNC_README`, and recognized asset files in `/assets` with `SYNC_ASSETS` 9. Shows the `svn status`, the removed files, and the `readme.txt` diff in the log and in the job summary on the run page From 5cd50596745bd17447dc3fd2d4251fa144ffc98b Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Thu, 29 Oct 2026 10:45:47 +0200 Subject: [PATCH 09/34] Show skipped trunk readme in the job summary - repeat the trunk warning in the job summary, where it's harder to miss - mention the summary in the trunk previews docs --- .github/workflows/wordpress-org-plugin-page.yml | 7 +++++++ docs/wordpress-org-plugin-page.md | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/wordpress-org-plugin-page.yml b/.github/workflows/wordpress-org-plugin-page.yml index 64b93a180..e9d203983 100644 --- a/.github/workflows/wordpress-org-plugin-page.yml +++ b/.github/workflows/wordpress-org-plugin-page.yml @@ -417,6 +417,13 @@ jobs: echo "ℹ️ trunk/readme.txt already matches readme.txt from Git" else echo "::warning title=trunk/readme.txt left unchanged::SVN trunk contains unreleased readme.txt changes (likely a trunk preview). Only $TAG_README was updated. Make sure the same change is part of the upcoming release." + + # Warnings are easy to miss, so this is repeated in the job summary next to the SVN changes. + { + echo '### ⚠️ trunk/readme.txt left unchanged' + echo "SVN trunk holds unreleased \`readme.txt\` changes (likely a trunk preview), so only \`$TAG_README\` is updated. Make sure the same change is in the next release." + echo + } >> "$GITHUB_STEP_SUMMARY" fi - name: Synchronize assets diff --git a/docs/wordpress-org-plugin-page.md b/docs/wordpress-org-plugin-page.md index 7d2ae4854..31a840bcc 100644 --- a/docs/wordpress-org-plugin-page.md +++ b/docs/wordpress-org-plugin-page.md @@ -144,7 +144,7 @@ Then: ## Trunk previews -If SVN `trunk/readme.txt` differs from `tags//readme.txt` before the sync, trunk holds unreleased changes, for example a preview published with the release workflow's `UPDATE_TRUNK_ONLY` mode. Overwriting it would silently revert those changes, so in that case the workflow only updates the tag's `readme.txt` and emits a warning. Make sure the same change is part of the upcoming release, so that it isn't lost when the next version is published. +If SVN `trunk/readme.txt` differs from `tags//readme.txt` before the sync, trunk holds unreleased changes, for example a preview published with the release workflow's `UPDATE_TRUNK_ONLY` mode. Overwriting it would silently revert those changes, so in that case the workflow only updates the tag's `readme.txt` and shows a warning, both as an annotation and in the job summary. Make sure the same change is part of the upcoming release, so that it isn't lost when the next version is published. ## Release Confirmation From 37a2a3c848ab502a0f2952541bd8ab606a909e8d Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Thu, 29 Oct 2026 10:49:21 +0200 Subject: [PATCH 10/34] Clarify when a missing mime type affects assets --- .github/workflows/wordpress-org-plugin-page.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wordpress-org-plugin-page.yml b/.github/workflows/wordpress-org-plugin-page.yml index e9d203983..f618a3536 100644 --- a/.github/workflows/wordpress-org-plugin-page.yml +++ b/.github/workflows/wordpress-org-plugin-page.yml @@ -450,7 +450,7 @@ jobs: done fi - # Without a correct svn:mime-type, browsers download assets instead of displaying them. + # Without a correct svn:mime-type, browsers may download assets instead of displaying them when opened directly. # 'svn add' marks binaries as application/octet-stream, so this also fixes newly added files. find assets -type f | while IFS= read -r file; do case "${file,,}" in From b22608fb0a36e48c86681386f22a105d31d0a921 Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Thu, 29 Oct 2026 10:51:02 +0200 Subject: [PATCH 11/34] Shorten scope guard comment to its intention --- .github/workflows/wordpress-org-plugin-page.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/wordpress-org-plugin-page.yml b/.github/workflows/wordpress-org-plugin-page.yml index f618a3536..28c802443 100644 --- a/.github/workflows/wordpress-org-plugin-page.yml +++ b/.github/workflows/wordpress-org-plugin-page.yml @@ -477,9 +477,7 @@ jobs: cd "$SVN_REPO_ROOT" - # Defense in depth: this workflow must never touch plugin code, and only touches - # what the enabled options allow. Readme paths are matched literally (no regex), - # so version dots can't act as wildcards. + # Defense in depth: whatever the steps above did, only files allowed by the enabled options get committed. is_allowed() { local STATUS="$1" FILE="$2" From db736add40722e3c6da1c7b76e60ef28cffad937 Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Thu, 29 Oct 2026 10:57:14 +0200 Subject: [PATCH 12/34] Allow only modified readmes in the scope guard - reject added or deleted readmes and property-only readme changes - explain why any file in /assets may be deleted --- .github/workflows/wordpress-org-plugin-page.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/wordpress-org-plugin-page.yml b/.github/workflows/wordpress-org-plugin-page.yml index 28c802443..e3db35351 100644 --- a/.github/workflows/wordpress-org-plugin-page.yml +++ b/.github/workflows/wordpress-org-plugin-page.yml @@ -481,7 +481,8 @@ jobs: is_allowed() { local STATUS="$1" FILE="$2" - if [ "$SYNC_README" = "true" ]; then + # The readmes may only be modified, never added or deleted. + if [ "$SYNC_README" = "true" ] && [ "$STATUS" = "M" ]; then case "$FILE" in trunk/readme.txt|"tags/$STABLE_TAG/readme.txt") return 0 ;; esac @@ -491,7 +492,8 @@ jobs: case "$FILE" in assets|assets/blueprints) return 0 ;; assets/*) - # Removing a file is always fine, e.g. a legacy file with a name WordPress.org ignores. + # Mirroring deletes whatever isn't in Git, including legacy files with names WordPress.org + # ignores, so any file in /assets may be deleted. Added or modified files must be recognized assets. [ "$STATUS" = "D" ] && return 0 local ASSET="${FILE#assets/}" [ "$ASSET" = "icon.svg" ] && return 0 From a2cae65f4c145bbd7615b4bce74e317e80689005 Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Thu, 29 Oct 2026 11:01:42 +0200 Subject: [PATCH 13/34] Describe re-runs precisely instead of calling them idempotent - a run without changes is not an error - a re-run with a branch as GIT_REF uses the branch's current state --- .github/workflows/wordpress-org-plugin-page.yml | 2 +- docs/wordpress-org-plugin-page.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/wordpress-org-plugin-page.yml b/.github/workflows/wordpress-org-plugin-page.yml index e3db35351..1ba1ae43e 100644 --- a/.github/workflows/wordpress-org-plugin-page.yml +++ b/.github/workflows/wordpress-org-plugin-page.yml @@ -593,7 +593,7 @@ jobs: run: | set -euo pipefail - # Unlike a release, updating the plugin page is idempotent: re-running without changes is fine. + # Unlike a release, a run without changes is not an error: the plugin page is already up to date. if [ "$HAS_CHANGES" != "true" ]; then echo "::notice title=No changes::The WordPress.org plugin page is already up to date" exit 0 diff --git a/docs/wordpress-org-plugin-page.md b/docs/wordpress-org-plugin-page.md index 31a840bcc..ebecdecdf 100644 --- a/docs/wordpress-org-plugin-page.md +++ b/docs/wordpress-org-plugin-page.md @@ -228,6 +228,6 @@ If nothing would change, no artifact is uploaded and the job summary says that t ## Troubleshooting -The workflow is idempotent: changes are committed in a single atomic SVN commit, and a run without changes succeeds. If a run fails, even in the commit step because of a network error, **Re-run failed jobs** is always safe. The re-run either commits the changes or reports that the plugin page is already up to date, so there is no need to fix anything in SVN by hand. +Changes are committed in a single atomic SVN commit, and a run without changes succeeds. If a run fails, even in the commit step because of a network error, **Re-run failed jobs** is always safe. The re-run either commits the changes or reports that the plugin page is already up to date, so there is no need to fix anything in SVN by hand. If `GIT_REF` is a branch, a re-run uses its current state, which may include newer commits. If someone else commits to the plugin's SVN repository while the workflow runs (e.g. a release running at the same time), the commit fails with an `out of date` error and nothing is changed. Re-run the workflow once the other run has finished. From b818f027decc740ed64ff00c10fd5bfa2c1381cb Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Thu, 29 Oct 2026 11:04:20 +0200 Subject: [PATCH 14/34] Remove redundant commit message comment --- .github/workflows/wordpress-org-plugin-page.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/wordpress-org-plugin-page.yml b/.github/workflows/wordpress-org-plugin-page.yml index 1ba1ae43e..923ed82d3 100644 --- a/.github/workflows/wordpress-org-plugin-page.yml +++ b/.github/workflows/wordpress-org-plugin-page.yml @@ -602,7 +602,6 @@ jobs: cd "$SVN_REPO_ROOT" mapfile -t COMMIT_PATHS < "$COMMIT_PATHS_FILE" - # svn log -v lists the exact paths, so the message doesn't repeat them. COMMIT_MESSAGE="Update plugin page from ${GIT_REF}@${SHORT_SHA}" COMMIT_LOG="${RUNNER_TEMP}/svn-commit.log" From 96b938536e0c8302ede72dca9cffb3f2c041c1e0 Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Thu, 29 Oct 2026 11:06:55 +0200 Subject: [PATCH 15/34] Remove redundant atomic commit comment --- .github/workflows/wordpress-org-plugin-page.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/wordpress-org-plugin-page.yml b/.github/workflows/wordpress-org-plugin-page.yml index 923ed82d3..6a02549b6 100644 --- a/.github/workflows/wordpress-org-plugin-page.yml +++ b/.github/workflows/wordpress-org-plugin-page.yml @@ -617,8 +617,6 @@ jobs: --no-auth-cache \ --non-interactive \ -m "$COMMIT_MESSAGE" 2>&1 | tee "$COMMIT_LOG"; then - - # SVN commits are atomic: on a conflict nothing is committed. if grep -qE 'E160028|E160024|out of date' "$COMMIT_LOG"; then echo "::error title=Concurrent SVN commit::Someone else committed to this plugin on WordPress.org in the meantime (maybe a release running at the same time). Nothing was changed. Re-run this workflow once the other run has finished." fi From 4082b871b4c3cfc04c21a148909d5a0b9de88798 Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Thu, 29 Oct 2026 11:20:59 +0200 Subject: [PATCH 16/34] Remove the automatic sync on merge example Syncing on every push can publish plugin page changes as an unexpected side effect of merging, so the docs no longer suggest it. --- docs/wordpress-org-plugin-page.md | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/docs/wordpress-org-plugin-page.md b/docs/wordpress-org-plugin-page.md index ebecdecdf..23b69a1e5 100644 --- a/docs/wordpress-org-plugin-page.md +++ b/docs/wordpress-org-plugin-page.md @@ -77,32 +77,6 @@ jobs: > [!IMPORTANT] > `DRY_RUN` defaults to `true`, so a caller that doesn't pass it only previews the changes. Set `DRY_RUN: false` to actually update the plugin page. -## Update assets automatically on merge - -Because the assets directory is validated and mirrored, it can be synced whenever it changes on the main branch: - -```yml -name: Update WordPress.org assets -on: - push: - branches: [main] - paths: ['.wordpress-org/**'] -jobs: - update-assets: - uses: inpsyde/reusable-workflows/.github/workflows/wordpress-org-plugin-page.yml@main - with: - SVN_PLUGIN_SLUG: my-plugin - GIT_REF: ${{ github.sha }} - SYNC_README: false - DRY_RUN: false - secrets: - SVN_USERNAME: ${{ secrets.SVN_USERNAME }} - SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} -``` - -> [!NOTE] -> Only automate readme syncing if the branch's `readme.txt` always describes the published version. Otherwise, keep `SYNC_README: false` for automated runs and update the readme through a manually triggered run. - ## Advanced usage: requiring manual approval To require approval before the plugin page is updated, add an `environment:` key to the calling job and configure protection rules (required reviewers, wait timers, etc.) for that environment in your repository settings under **Settings → Environments**. From 9c5855c4adcae0da25c7c10fb01bfe10c99e9f93 Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Thu, 29 Oct 2026 11:26:50 +0200 Subject: [PATCH 17/34] Refuse to remove the last icon or banner from the plugin page - fail if mirroring would leave the plugin page without an icon or banner - warn if it removes all screenshots - catches an incomplete assets directory before anything is committed --- .../workflows/wordpress-org-plugin-page.yml | 56 +++++++++++++++++++ docs/wordpress-org-plugin-page.md | 3 +- 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/.github/workflows/wordpress-org-plugin-page.yml b/.github/workflows/wordpress-org-plugin-page.yml index 6a02549b6..9ce51310b 100644 --- a/.github/workflows/wordpress-org-plugin-page.yml +++ b/.github/workflows/wordpress-org-plugin-page.yml @@ -467,6 +467,62 @@ jobs: fi done + - name: Verify the plugin page keeps its icon and banner + if: inputs.SYNC_ASSETS == true + env: + ASSETS_DIR: ${{ inputs.ASSETS_DIR }} + run: | + set -euo pipefail + + cd "$SVN_REPO_ROOT" + + # An incomplete assets directory would strip the plugin page, so removing the last icon or banner is refused. + mapfile -t DELETED < <(svn status assets | grep '^D' | cut -c9- | sed 's|^assets/||' || true) + mapfile -t REMAINING < <(cd assets && find . -type f ! -path '*/.*' -printf '%P\n') + + count_assets() { + local TYPE="$1" COUNT=0 NAME LOWER + shift + for NAME in "$@"; do + LOWER="${NAME,,}" + case "$TYPE" in + icon) [[ "$LOWER" =~ $ICON_RE || "$NAME" = "icon.svg" ]] ;; + banner) [[ "$LOWER" =~ $BANNER_RE ]] ;; + screenshot) [[ "$LOWER" =~ $SCREENSHOT_RE ]] ;; + esac && COUNT=$((COUNT + 1)) + done + echo "$COUNT" + } + + removes_all() { + [ "$(count_assets "$1" "${DELETED[@]}")" -gt 0 ] && [ "$(count_assets "$1" "${REMAINING[@]}")" -eq 0 ] + } + + ERRORS=0 + for TYPE in icon banner; do + if removes_all "$TYPE"; then + echo "❌ This run would remove every $TYPE from the plugin page." + echo " Add a $TYPE to $ASSETS_DIR, or remove it by hand in SVN if that's really intended." + ERRORS=1 + fi + done + + if [ "$ERRORS" = "1" ]; then + exit 1 + fi + + # Removing all screenshots can be intended, but leaves the readme's screenshot captions without images. + if removes_all screenshot; then + echo "::warning title=All screenshots removed::This run removes every screenshot from the plugin page. Make sure the == Screenshots == section of readme.txt matches." + { + echo '### ⚠️ All screenshots removed' + echo "This run removes every screenshot from the plugin page. Make sure the \`== Screenshots ==\` section of \`readme.txt\` matches." + echo + } >> "$GITHUB_STEP_SUMMARY" + fi + + echo "✅ The plugin page keeps its icon and banner" + - name: Verify only plugin page files are changed env: SYNC_README: ${{ inputs.SYNC_README }} diff --git a/docs/wordpress-org-plugin-page.md b/docs/wordpress-org-plugin-page.md index 23b69a1e5..33ada4b6c 100644 --- a/docs/wordpress-org-plugin-page.md +++ b/docs/wordpress-org-plugin-page.md @@ -20,7 +20,7 @@ To achieve that, this workflow: 4. Checks out only the needed parts of the WordPress.org SVN repository: `trunk/readme.txt`, the list of tags, the readme of the stable tag, and `/assets`. Plugin code is never fetched 5. Verifies that the `Stable tag` in Git equals the `Stable tag` in SVN trunk and that this tag exists 6. Copies `readme.txt` into `tags//` (which is what WordPress.org renders) and into `trunk/`. The trunk copy is skipped with a warning if trunk contains unreleased changes, see [Trunk previews](#trunk-previews). A warning is also shown if `Requires at least` or `Requires PHP` changes: unless the main plugin file declares them, WordPress uses these values to block installs and updates of the published version on sites that don't meet them. A notice reminds about [Release Confirmation](#release-confirmation) whenever the tag's `readme.txt` changes -7. Mirrors `ASSETS_DIR` to SVN `/assets` via `rsync --delete`, so files removed from Git are removed from WordPress.org as well, and sets the correct `svn:mime-type` on every asset +7. Mirrors `ASSETS_DIR` to SVN `/assets` via `rsync --delete`, so files removed from Git are removed from WordPress.org as well, and sets the correct `svn:mime-type` on every asset. Fails if this would remove the last icon or banner from the plugin page, and warns if it removes all screenshots 8. Fails if anything would change that the enabled options don't allow: `trunk/readme.txt` and `tags//readme.txt` with `SYNC_README`, and recognized asset files in `/assets` with `SYNC_ASSETS` 9. Shows the `svn status`, the removed files, and the `readme.txt` diff in the log and in the job summary on the run page 10. Commits all changes in a single SVN commit (or uploads them as an artifact in `DRY_RUN` mode). If nothing changed, the workflow ends successfully without committing @@ -142,6 +142,7 @@ Asset-only runs (`SYNC_README: false`) don't touch any tag and are not affected. Any file with a name WordPress.org would ignore fails the validation. On top of the WordPress.org rules, this workflow requires: - a raster fallback for `icon.svg` +- at least one icon and one banner, if the plugin page has them today. A run that would remove the last one fails, which catches an incomplete assets directory. To remove them on purpose, delete them by hand in SVN - at most 10 blueprints (WordPress.org would silently import only the first 10) - banners and raster icons with exactly the dimensions their name says, and raster files in the format their extension says - regular files only: symlinks and subdirectories other than `blueprints/` are rejected From 7309726f9166edc02aebbae6273e3afbc5c1b83b Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Thu, 29 Oct 2026 11:28:32 +0200 Subject: [PATCH 18/34] Merge concurrent commit note into the re-run paragraph --- docs/wordpress-org-plugin-page.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/wordpress-org-plugin-page.md b/docs/wordpress-org-plugin-page.md index 33ada4b6c..97e54f70c 100644 --- a/docs/wordpress-org-plugin-page.md +++ b/docs/wordpress-org-plugin-page.md @@ -203,6 +203,4 @@ If nothing would change, no artifact is uploaded and the job summary says that t ## Troubleshooting -Changes are committed in a single atomic SVN commit, and a run without changes succeeds. If a run fails, even in the commit step because of a network error, **Re-run failed jobs** is always safe. The re-run either commits the changes or reports that the plugin page is already up to date, so there is no need to fix anything in SVN by hand. If `GIT_REF` is a branch, a re-run uses its current state, which may include newer commits. - -If someone else commits to the plugin's SVN repository while the workflow runs (e.g. a release running at the same time), the commit fails with an `out of date` error and nothing is changed. Re-run the workflow once the other run has finished. +Changes are committed in a single atomic SVN commit, and a run without changes succeeds. If a run fails, even in the commit step because of a network error, **Re-run failed jobs** is always safe. The re-run either commits the changes or reports that the plugin page is already up to date, so there is no need to fix anything in SVN by hand. If the commit failed because someone else committed in the meantime (e.g. a release running at the same time), wait until that run has finished. If `GIT_REF` is a branch, a re-run uses its current state, which may include newer commits. From 753740d5ada3d671e78863f2c6d2b9b5d50fd70d Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Thu, 29 Oct 2026 11:36:09 +0200 Subject: [PATCH 19/34] Reject icon.svg files that are not SVG images --- .github/workflows/wordpress-org-plugin-page.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/wordpress-org-plugin-page.yml b/.github/workflows/wordpress-org-plugin-page.yml index 9ce51310b..8a4462bfb 100644 --- a/.github/workflows/wordpress-org-plugin-page.yml +++ b/.github/workflows/wordpress-org-plugin-page.yml @@ -258,6 +258,13 @@ jobs: *.png) EXPECTED_FORMAT="PNG" ;; *.jpg|*.jpeg) EXPECTED_FORMAT="JPEG" ;; *.gif) EXPECTED_FORMAT="GIF" ;; + *.svg) + if ! grep -qi ' Date: Thu, 29 Oct 2026 11:36:38 +0200 Subject: [PATCH 20/34] Count only default icons and banners when guarding against removal --- .github/workflows/wordpress-org-plugin-page.yml | 7 ++++--- docs/wordpress-org-plugin-page.md | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/wordpress-org-plugin-page.yml b/.github/workflows/wordpress-org-plugin-page.yml index 8a4462bfb..6c8dfad07 100644 --- a/.github/workflows/wordpress-org-plugin-page.yml +++ b/.github/workflows/wordpress-org-plugin-page.yml @@ -487,15 +487,16 @@ jobs: mapfile -t DELETED < <(svn status assets | grep '^D' | cut -c9- | sed 's|^assets/||' || true) mapfile -t REMAINING < <(cd assets && find . -type f ! -path '*/.*' -printf '%P\n') + # Only default assets count: localized ones (-rtl, -de, ...) are shown just for those locales. count_assets() { local TYPE="$1" COUNT=0 NAME LOWER shift for NAME in "$@"; do LOWER="${NAME,,}" case "$TYPE" in - icon) [[ "$LOWER" =~ $ICON_RE || "$NAME" = "icon.svg" ]] ;; - banner) [[ "$LOWER" =~ $BANNER_RE ]] ;; - screenshot) [[ "$LOWER" =~ $SCREENSHOT_RE ]] ;; + icon) [[ "$LOWER" =~ ^icon-(128x128|256x256)\.(png|jpg|jpeg|gif)$ || "$NAME" = "icon.svg" ]] ;; + banner) [[ "$LOWER" =~ ^banner-(772x250|1544x500)\.(png|jpg|jpeg|gif)$ ]] ;; + screenshot) [[ "$LOWER" =~ ^screenshot-[0-9]+\.(png|jpg|jpeg|gif)$ ]] ;; esac && COUNT=$((COUNT + 1)) done echo "$COUNT" diff --git a/docs/wordpress-org-plugin-page.md b/docs/wordpress-org-plugin-page.md index 97e54f70c..566e330fd 100644 --- a/docs/wordpress-org-plugin-page.md +++ b/docs/wordpress-org-plugin-page.md @@ -142,7 +142,7 @@ Asset-only runs (`SYNC_README: false`) don't touch any tag and are not affected. Any file with a name WordPress.org would ignore fails the validation. On top of the WordPress.org rules, this workflow requires: - a raster fallback for `icon.svg` -- at least one icon and one banner, if the plugin page has them today. A run that would remove the last one fails, which catches an incomplete assets directory. To remove them on purpose, delete them by hand in SVN +- at least one default (non-localized) icon and banner, if the plugin page has them today. A run that would remove the last one fails, which catches an incomplete assets directory. To remove them on purpose, delete them by hand in SVN - at most 10 blueprints (WordPress.org would silently import only the first 10) - banners and raster icons with exactly the dimensions their name says, and raster files in the format their extension says - regular files only: symlinks and subdirectories other than `blueprints/` are rejected From 5639c5658f71d10f62eb73fd5d69f364ad1d637d Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Thu, 29 Oct 2026 11:37:26 +0200 Subject: [PATCH 21/34] Include only changed paths in the dry run artifact --- .../workflows/wordpress-org-plugin-page.yml | 29 ++++++++----------- docs/wordpress-org-plugin-page.md | 8 ++--- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/.github/workflows/wordpress-org-plugin-page.yml b/.github/workflows/wordpress-org-plugin-page.yml index 6c8dfad07..55bb1ecda 100644 --- a/.github/workflows/wordpress-org-plugin-page.yml +++ b/.github/workflows/wordpress-org-plugin-page.yml @@ -700,24 +700,19 @@ jobs: cd "$SVN_REPO_ROOT" - # The preview holds exactly what would be committed, in its final state. + # The preview holds exactly what would be committed, in its final state: + # each path only if it changes (e.g. trunk is left alone when it holds unreleased changes). while IFS= read -r COMMIT_PATH; do - case "$COMMIT_PATH" in - assets) - rsync -r --exclude='.svn' assets/ "$PREVIEW_DIR/assets/" - ;; - trunk/readme.txt) - # trunk is left alone when it holds unreleased changes, so include it only if it changes. - if [ -n "$(svn status trunk/readme.txt)" ]; then - mkdir -p "$PREVIEW_DIR/trunk" - cp trunk/readme.txt "$PREVIEW_DIR/trunk/readme.txt" - fi - ;; - *) - mkdir -p "$PREVIEW_DIR/$(dirname "$COMMIT_PATH")" - cp "$COMMIT_PATH" "$PREVIEW_DIR/$COMMIT_PATH" - ;; - esac + if [ -z "$(svn status "$COMMIT_PATH")" ]; then + continue + fi + + if [ "$COMMIT_PATH" = "assets" ]; then + rsync -r --exclude='.svn' assets/ "$PREVIEW_DIR/assets/" + else + mkdir -p "$PREVIEW_DIR/$(dirname "$COMMIT_PATH")" + cp "$COMMIT_PATH" "$PREVIEW_DIR/$COMMIT_PATH" + fi done < "$COMMIT_PATHS_FILE" - name: Upload dry run preview as an artifact diff --git a/docs/wordpress-org-plugin-page.md b/docs/wordpress-org-plugin-page.md index 566e330fd..cc7d44dcd 100644 --- a/docs/wordpress-org-plugin-page.md +++ b/docs/wordpress-org-plugin-page.md @@ -193,11 +193,11 @@ At least one of `SYNC_README` and `SYNC_ASSETS` must be enabled. With `DRY_RUN: true`, nothing is committed. The job summary on the run page shows every file that would be added (`A`), deleted (`D`), modified (`M`), or have its properties changed (` M`), lists removed files separately, and shows the `readme.txt` diff. -If anything would change, an artifact named `-plugin-page` is uploaded. It contains exactly what would be committed, in its final state: +If anything would change, an artifact named `-plugin-page` is uploaded. It contains exactly what would be committed, in its final state, each only if it would change: -- `tags//readme.txt` (with `SYNC_README`) -- `trunk/readme.txt`, only if it would change (see [Trunk previews](#trunk-previews)) -- `assets/`: the complete assets directory (with `SYNC_ASSETS`) +- `tags//readme.txt` +- `trunk/readme.txt` (see [Trunk previews](#trunk-previews)) +- `assets/`: the complete assets directory, if anything in it would change If nothing would change, no artifact is uploaded and the job summary says that the plugin page is already up to date. From cede63f690e491696dcfbe8972e9d6145463bac0 Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Thu, 29 Oct 2026 11:37:52 +0200 Subject: [PATCH 22/34] Skip hidden files when setting asset mime types --- .github/workflows/wordpress-org-plugin-page.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wordpress-org-plugin-page.yml b/.github/workflows/wordpress-org-plugin-page.yml index 55bb1ecda..80b635dc2 100644 --- a/.github/workflows/wordpress-org-plugin-page.yml +++ b/.github/workflows/wordpress-org-plugin-page.yml @@ -459,7 +459,7 @@ jobs: # Without a correct svn:mime-type, browsers may download assets instead of displaying them when opened directly. # 'svn add' marks binaries as application/octet-stream, so this also fixes newly added files. - find assets -type f | while IFS= read -r file; do + find assets -type f ! -path '*/.*' | while IFS= read -r file; do case "${file,,}" in *.png) MIME_TYPE="image/png" ;; *.jpg|*.jpeg) MIME_TYPE="image/jpeg" ;; From 9f05b47ba4e11aa23473bce34455c60e944a2e53 Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Thu, 29 Oct 2026 11:37:59 +0200 Subject: [PATCH 23/34] Document re-running after a concurrent release --- docs/wordpress-org-plugin-page.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/wordpress-org-plugin-page.md b/docs/wordpress-org-plugin-page.md index cc7d44dcd..a4882c154 100644 --- a/docs/wordpress-org-plugin-page.md +++ b/docs/wordpress-org-plugin-page.md @@ -203,4 +203,4 @@ If nothing would change, no artifact is uploaded and the job summary says that t ## Troubleshooting -Changes are committed in a single atomic SVN commit, and a run without changes succeeds. If a run fails, even in the commit step because of a network error, **Re-run failed jobs** is always safe. The re-run either commits the changes or reports that the plugin page is already up to date, so there is no need to fix anything in SVN by hand. If the commit failed because someone else committed in the meantime (e.g. a release running at the same time), wait until that run has finished. If `GIT_REF` is a branch, a re-run uses its current state, which may include newer commits. +Changes are committed in a single atomic SVN commit, and a run without changes succeeds. If a run fails, even in the commit step because of a network error, **Re-run failed jobs** is always safe. The re-run either commits the changes or reports that the plugin page is already up to date, so there is no need to fix anything in SVN by hand. If the commit failed because someone else committed in the meantime (e.g. a release running at the same time), wait until that run has finished. If that was a release, the re-run fails the Stable tag check instead, because the release published a new version: run the workflow again with a `GIT_REF` that matches it. If `GIT_REF` is a branch, a re-run uses its current state, which may include newer commits. From 0ddd8df1b60ecf604a3781caf93bb4c21c1cc93e Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Thu, 29 Oct 2026 11:38:11 +0200 Subject: [PATCH 24/34] Document that GIT_REF needs a full commit SHA --- .github/workflows/wordpress-org-plugin-page.yml | 2 +- docs/wordpress-org-plugin-page.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/wordpress-org-plugin-page.yml b/.github/workflows/wordpress-org-plugin-page.yml index 80b635dc2..de396f77a 100644 --- a/.github/workflows/wordpress-org-plugin-page.yml +++ b/.github/workflows/wordpress-org-plugin-page.yml @@ -11,7 +11,7 @@ on: required: true GIT_REF: - description: "Git ref to read readme.txt and the assets directory from (tag, branch, or commit)" + description: "Git ref to read readme.txt and the assets directory from (tag, branch, or full commit SHA)" type: string required: true diff --git a/docs/wordpress-org-plugin-page.md b/docs/wordpress-org-plugin-page.md index a4882c154..9f42bdf07 100644 --- a/docs/wordpress-org-plugin-page.md +++ b/docs/wordpress-org-plugin-page.md @@ -171,7 +171,7 @@ Banners, icons, and screenshots can be localized with an `-rtl` and/or a locale | Name | Required | Default | Description | |---|---|---|---| | `SVN_PLUGIN_SLUG` | yes | — | WordPress.org plugin slug (e.g. `my-plugin`) | -| `GIT_REF` | yes | — | Git ref to read `readme.txt` and the assets directory from (tag, branch, or commit SHA) | +| `GIT_REF` | yes | — | Git ref to read `readme.txt` and the assets directory from (tag, branch, or full 40-character commit SHA) | | `SYNC_README` | no | `true` | Update `readme.txt` in SVN trunk and in the tag referenced by `Stable tag` | | `SYNC_ASSETS` | no | `true` | Mirror `ASSETS_DIR` to the SVN `/assets` directory | | `ASSETS_DIR` | no | `.wordpress-org` | Directory in the Git repository holding the WordPress.org assets | From 173fdd99f853345260904cba54400146cd88fbac Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Thu, 29 Oct 2026 11:42:17 +0200 Subject: [PATCH 25/34] Install asset tools only when syncing assets --- .github/workflows/wordpress-org-plugin-page.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/wordpress-org-plugin-page.yml b/.github/workflows/wordpress-org-plugin-page.yml index de396f77a..dd9d883f6 100644 --- a/.github/workflows/wordpress-org-plugin-page.yml +++ b/.github/workflows/wordpress-org-plugin-page.yml @@ -64,9 +64,20 @@ jobs: BLUEPRINT_RE: '^blueprints/blueprint[-A-Za-z0-9_]*\.json$' steps: - name: Install required tools + env: + SYNC_ASSETS: ${{ inputs.SYNC_ASSETS }} run: | + set -euo pipefail + + PACKAGES=(subversion) + + # Only the asset validation and sync need these. + if [ "$SYNC_ASSETS" = "true" ]; then + PACKAGES+=(rsync jq imagemagick) + fi + sudo apt-get update -y - sudo apt-get install -y subversion rsync jq imagemagick + sudo apt-get install -y "${PACKAGES[@]}" - name: Validate inputs env: From 2e53bb47131fc4a4b2049c0b53772ac3bb119842 Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Mon, 23 Nov 2026 18:22:04 +0200 Subject: [PATCH 26/34] Warn about unreleased readme content when choosing GIT_REF A development branch usually still carries the published Stable tag, so it passes the check while its readme.txt may already contain the next version's changelog. Recommend a branch created from the release tag instead, and show how to combine it with a branch restriction in the calling workflow. --- docs/wordpress-org-plugin-page.md | 48 ++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/docs/wordpress-org-plugin-page.md b/docs/wordpress-org-plugin-page.md index 9f42bdf07..9b8c87867 100644 --- a/docs/wordpress-org-plugin-page.md +++ b/docs/wordpress-org-plugin-page.md @@ -72,11 +72,31 @@ jobs: SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} ``` -`GIT_REF` should point to a ref whose `readme.txt` describes the **currently published** version, such as the Git tag of the latest release plus the cosmetic change, or the branch that holds the released state. A development branch whose `readme.txt` already carries the next version's `Stable tag` fails the Stable tag check by design. +For which ref to pass as `GIT_REF`, see [Choosing `GIT_REF`](#choosing-git_ref). > [!IMPORTANT] > `DRY_RUN` defaults to `true`, so a caller that doesn't pass it only previews the changes. Set `DRY_RUN: false` to actually update the plugin page. +## Choosing `GIT_REF` + +The workflow publishes `readme.txt` and `ASSETS_DIR` from `GIT_REF` as they are, and ignores the plugin code. In `GIT_REF`, both should match what is currently published, plus only the change you want to publish. + +To get there, create a branch from the latest release: its Git tag, or the commit you released from if you don't tag releases. If the plugin page was updated with this workflow after the release, create it from that update's branch instead, or your run reverts that update. + +```shell +git switch -c plugin-page/tested-up-to-6.9 v1.2.3 +# edit readme.txt, e.g. "Tested up to: 6.9" +git commit -am "Bump Tested up to 6.9" +git push -u origin HEAD +``` + +1. Run the workflow with `GIT_REF: plugin-page/tested-up-to-6.9` and `DRY_RUN: true`. In the job summary, the SVN changes and the `readme.txt` diff should show only your change. +2. Run it again with `DRY_RUN: false`. +3. Merge the branch into your development branch, so the next release keeps the change. + +> [!WARNING] +> A development branch is risky as `GIT_REF`. Until the next release, its `Stable tag` usually still names the published version, so the Stable tag check passes. But its `readme.txt` may already contain a changelog entry, upgrade notice, or FAQ entries for the next version, and its assets may include screenshots of unreleased features. The workflow publishes all of it without a warning. + ## Advanced usage: requiring manual approval To require approval before the plugin page is updated, add an `environment:` key to the calling job and configure protection rules (required reviewers, wait timers, etc.) for that environment in your repository settings under **Settings → Environments**. @@ -101,6 +121,32 @@ jobs: > [!WARNING] > An environment's **deployment branch** rule restricts the ref the *calling* workflow runs from, not `GIT_REF`. With `GIT_REF` as a free-text input, anyone allowed to run the workflow can publish the readme and assets from any branch, regardless of the environment rule. If you rely on branch rules, pass `${{ github.sha }}` or `${{ github.ref_name }}` as `GIT_REF`, or offer a `choice` input instead. +To use a branch created as described in [Choosing `GIT_REF`](#choosing-git_ref), run the calling workflow from that branch with `GIT_REF: ${{ github.sha }}`, and allow only `plugin-page/*` branches, with `if:` as below or with the environment's deployment branch rule. Both only check the branch name, not what the branch contains, so check the dry run either way. + +```yml +on: + workflow_dispatch: + inputs: + DRY_RUN: + description: 'Upload the changes as an artifact instead of committing to SVN' + type: boolean + default: true +jobs: + update-plugin-page: + if: startsWith(github.ref, 'refs/heads/plugin-page/') # runs from other branches are skipped + environment: wordpress-org + uses: inpsyde/reusable-workflows/.github/workflows/wordpress-org-plugin-page.yml@main + with: + SVN_PLUGIN_SLUG: my-plugin + GIT_REF: ${{ github.sha }} + DRY_RUN: ${{ inputs.DRY_RUN }} + secrets: + SVN_USERNAME: ${{ secrets.SVN_USERNAME }} + SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} +``` + +The calling workflow file must exist on that branch. If the release is older than the file, copy it over and commit it, e.g. `git restore --source=develop -- .github/workflows/update-plugin-page.yml`. + ## Adopting the workflow Assets are mirrored, so the assets directory in Git must contain **every** asset that should stay on WordPress.org. Before the first run, import the current assets from SVN: From 90a4ec7e808bbba642ab34b4b5d3ef4f9c2d8762 Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Mon, 23 Nov 2026 18:54:07 +0200 Subject: [PATCH 27/34] Stop marking blueprints as binary in SVN SVN treats application/json as a binary MIME type, so blueprint changes showed up as binary in svn diff and on plugins.trac.wordpress.org. The property didn't help browsers either: the server sends .json files as application/json with content-disposition: attachment, with or without it. Blueprints now get no svn:mime-type, and the property is removed where earlier runs set it. --- .github/workflows/wordpress-org-plugin-page.yml | 11 +++++++++-- docs/wordpress-org-plugin-page.md | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/wordpress-org-plugin-page.yml b/.github/workflows/wordpress-org-plugin-page.yml index dd9d883f6..c81aeb6a1 100644 --- a/.github/workflows/wordpress-org-plugin-page.yml +++ b/.github/workflows/wordpress-org-plugin-page.yml @@ -468,15 +468,22 @@ jobs: done fi - # Without a correct svn:mime-type, browsers may download assets instead of displaying them when opened directly. + # Without a correct svn:mime-type, browsers may download images instead of displaying them when opened directly. # 'svn add' marks binaries as application/octet-stream, so this also fixes newly added files. + # Blueprints get no svn:mime-type: SVN treats application/json as binary, which makes their diffs unreadable, + # and the server sends .json files as application/json anyway. Earlier runs set it, so it is removed here. find assets -type f ! -path '*/.*' | while IFS= read -r file; do case "${file,,}" in *.png) MIME_TYPE="image/png" ;; *.jpg|*.jpeg) MIME_TYPE="image/jpeg" ;; *.gif) MIME_TYPE="image/gif" ;; *.svg) MIME_TYPE="image/svg+xml" ;; - *.json) MIME_TYPE="application/json" ;; + *.json) + if [ -n "$(svn propget svn:mime-type "$file@" 2>/dev/null || true)" ]; then + svn propdel --quiet svn:mime-type "$file@" + fi + continue + ;; *) continue ;; esac diff --git a/docs/wordpress-org-plugin-page.md b/docs/wordpress-org-plugin-page.md index 9b8c87867..e1d992dc1 100644 --- a/docs/wordpress-org-plugin-page.md +++ b/docs/wordpress-org-plugin-page.md @@ -20,7 +20,7 @@ To achieve that, this workflow: 4. Checks out only the needed parts of the WordPress.org SVN repository: `trunk/readme.txt`, the list of tags, the readme of the stable tag, and `/assets`. Plugin code is never fetched 5. Verifies that the `Stable tag` in Git equals the `Stable tag` in SVN trunk and that this tag exists 6. Copies `readme.txt` into `tags//` (which is what WordPress.org renders) and into `trunk/`. The trunk copy is skipped with a warning if trunk contains unreleased changes, see [Trunk previews](#trunk-previews). A warning is also shown if `Requires at least` or `Requires PHP` changes: unless the main plugin file declares them, WordPress uses these values to block installs and updates of the published version on sites that don't meet them. A notice reminds about [Release Confirmation](#release-confirmation) whenever the tag's `readme.txt` changes -7. Mirrors `ASSETS_DIR` to SVN `/assets` via `rsync --delete`, so files removed from Git are removed from WordPress.org as well, and sets the correct `svn:mime-type` on every asset. Fails if this would remove the last icon or banner from the plugin page, and warns if it removes all screenshots +7. Mirrors `ASSETS_DIR` to SVN `/assets` via `rsync --delete`, so files removed from Git are removed from WordPress.org as well, and sets the correct `svn:mime-type` on every image (blueprints get none, so SVN keeps treating them as text). Fails if this would remove the last icon or banner from the plugin page, and warns if it removes all screenshots 8. Fails if anything would change that the enabled options don't allow: `trunk/readme.txt` and `tags//readme.txt` with `SYNC_README`, and recognized asset files in `/assets` with `SYNC_ASSETS` 9. Shows the `svn status`, the removed files, and the `readme.txt` diff in the log and in the job summary on the run page 10. Commits all changes in a single SVN commit (or uploads them as an artifact in `DRY_RUN` mode). If nothing changed, the workflow ends successfully without committing @@ -159,7 +159,7 @@ Then: 1. Commit the `.wordpress-org` directory. Don't store it in Git LFS, see [Supported asset files](#supported-asset-files). 2. Add `.wordpress-org/` to `.distignore` so the assets don't end up in the plugin package or in SVN trunk during releases. -3. Run the workflow with `DRY_RUN: true`. The SVN changes in the job summary should list **no content changes** in `/assets`. Property-only changes (` M`) are expected where existing assets lack the correct `svn:mime-type`. +3. Run the workflow with `DRY_RUN: true`. The SVN changes in the job summary should list **no content changes** in `/assets`. Property-only changes (` M`) are expected where existing images lack the correct `svn:mime-type`, or existing blueprints have one. 4. Fix any files the validation rejects. Some are ignored by WordPress.org (e.g. `icon_128x128.png`), others are only rejected by this workflow's stricter rules (e.g. a raster fallback for `icon.svg`). ## Trunk previews From 1040278799fa66de647db7ac580b6265df9109dd Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Mon, 23 Nov 2026 18:57:18 +0200 Subject: [PATCH 28/34] Show the Release Confirmation notice in the job summary The ::notice annotation is easy to miss, and on a live run the commit has already happened by the time anyone reads it. Repeat it in the job summary, like the trunk warning. Document what the importer does with the release ZIP and what the release cooldown is, based on the plugin directory's code. --- .github/workflows/wordpress-org-plugin-page.yml | 10 +++++++++- docs/wordpress-org-plugin-page.md | 7 ++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/wordpress-org-plugin-page.yml b/.github/workflows/wordpress-org-plugin-page.yml index c81aeb6a1..c99f58d1e 100644 --- a/.github/workflows/wordpress-org-plugin-page.yml +++ b/.github/workflows/wordpress-org-plugin-page.yml @@ -421,7 +421,15 @@ jobs: # WordPress.org treats any change to a released tag as a modified release, # and with Release Confirmation enabled that release must be confirmed again. if ! cmp -s "$GIT_README" "$TAG_README"; then - echo "::notice title=Release Confirmation::If this plugin has Release Confirmation enabled on WordPress.org, updating $TAG_README reopens release $STABLE_TAG for confirmation. All committers get an email, and the plugin page updates only after the release is confirmed again." + RC_MESSAGE="If this plugin has Release Confirmation enabled on WordPress.org, updating $TAG_README reopens release $STABLE_TAG for confirmation. All committers get an email, and the plugin page updates only after the release is confirmed again." + echo "::notice title=Release Confirmation::$RC_MESSAGE" + + # Notices are the easiest annotation to miss, so this is repeated in the job summary next to the SVN changes. + { + echo '### ℹ️ Release Confirmation' + echo "$RC_MESSAGE" + echo + } >> "$GITHUB_STEP_SUMMARY" fi # The plugin page is rendered from the readme.txt of the Stable tag. diff --git a/docs/wordpress-org-plugin-page.md b/docs/wordpress-org-plugin-page.md index e1d992dc1..5a29751d7 100644 --- a/docs/wordpress-org-plugin-page.md +++ b/docs/wordpress-org-plugin-page.md @@ -19,7 +19,7 @@ To achieve that, this workflow: 3. When `SYNC_ASSETS` is enabled, validates every file in `ASSETS_DIR` (names, size limits, real image format and dimensions, blueprint JSON), and fails if the directory is missing or empty, or contains symlinks or unsupported subdirectories 4. Checks out only the needed parts of the WordPress.org SVN repository: `trunk/readme.txt`, the list of tags, the readme of the stable tag, and `/assets`. Plugin code is never fetched 5. Verifies that the `Stable tag` in Git equals the `Stable tag` in SVN trunk and that this tag exists -6. Copies `readme.txt` into `tags//` (which is what WordPress.org renders) and into `trunk/`. The trunk copy is skipped with a warning if trunk contains unreleased changes, see [Trunk previews](#trunk-previews). A warning is also shown if `Requires at least` or `Requires PHP` changes: unless the main plugin file declares them, WordPress uses these values to block installs and updates of the published version on sites that don't meet them. A notice reminds about [Release Confirmation](#release-confirmation) whenever the tag's `readme.txt` changes +6. Copies `readme.txt` into `tags//` (which is what WordPress.org renders) and into `trunk/`. The trunk copy is skipped with a warning if trunk contains unreleased changes, see [Trunk previews](#trunk-previews). A warning is also shown if `Requires at least` or `Requires PHP` changes: unless the main plugin file declares them, WordPress uses these values to block installs and updates of the published version on sites that don't meet them. A notice and the job summary remind about [Release Confirmation](#release-confirmation) whenever the tag's `readme.txt` changes 7. Mirrors `ASSETS_DIR` to SVN `/assets` via `rsync --delete`, so files removed from Git are removed from WordPress.org as well, and sets the correct `svn:mime-type` on every image (blueprints get none, so SVN keeps treating them as text). Fails if this would remove the last icon or banner from the plugin page, and warns if it removes all screenshots 8. Fails if anything would change that the enabled options don't allow: `trunk/readme.txt` and `tags//readme.txt` with `SYNC_README`, and recognized asset files in `/assets` with `SYNC_ASSETS` 9. Shows the `svn status`, the removed files, and the `readme.txt` diff in the log and in the job summary on the run page @@ -176,10 +176,11 @@ If SVN `trunk/readme.txt` differs from `tags//readme.txt` before the Judging by the plugin directory importer's code, the scenario appears to be handled: WordPress.org treats any commit to an already released tag as a [modified release](https://github.com/WordPress/wordpress.org/commit/8d1727f0e331ccfebce432bdfcf4c30db16e2803), even one that only changes `readme.txt`. Updating `tags//readme.txt` then: - reopens that release for confirmation and sends the confirmation email to all committers again -- restarts the release cooldown +- restarts the release cooldown, a delay WordPress.org can apply before it serves a new release - keeps the plugin page from updating until the release is confirmed again +- marks the release's ZIP as not built, so it is rebuilt with the new `readme.txt` once the release is confirmed again -This behavior isn't documented and may change. It's also unclear whether the downloadable ZIP of the release is rebuilt with the new `readme.txt`. +This behavior isn't documented and may change. Whenever the tag's `readme.txt` changes, the workflow points this out in a notice and in the job summary. Asset-only runs (`SYNC_README: false`) don't touch any tag and are not affected. From 511ec9a1d17f959ba406c640d560bcf76a716e7e Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Mon, 23 Nov 2026 19:20:28 +0200 Subject: [PATCH 29/34] Reject symlinks that point outside the repository A symlinked readme.txt was followed by the validation and the copy into SVN, so it could publish any file on the runner that passes the Stable tag check. The release workflow skips symlinks, so such a readme would never be released either: reject it. The ASSETS_DIR input check can't see symlinks. Resolve the directory after checkout and fail if it, or one of its parents, points outside the repository. --- .github/workflows/wordpress-org-plugin-page.yml | 17 +++++++++++++++++ docs/wordpress-org-plugin-page.md | 4 ++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/wordpress-org-plugin-page.yml b/.github/workflows/wordpress-org-plugin-page.yml index c99f58d1e..0cb197cee 100644 --- a/.github/workflows/wordpress-org-plugin-page.yml +++ b/.github/workflows/wordpress-org-plugin-page.yml @@ -108,6 +108,7 @@ jobs: fi # ASSETS_DIR is used as an rsync source, so keep it inside the repository. + # Symlinks can only be checked after the checkout, see "Validate assets directory". if [[ ! "$ASSETS_DIR" =~ ^[A-Za-z0-9._-]+(/[A-Za-z0-9._-]+)*$ ]] || [[ "/$ASSETS_DIR/" == *"/../"* ]]; then echo "❌ Invalid ASSETS_DIR: $ASSETS_DIR" echo " Must be a relative path inside the repository, without '..' segments" @@ -135,6 +136,13 @@ jobs: run: | set -euo pipefail + # A symlink could point anywhere on the runner, and the file it points to would be published. + # wordpress-org-release skips symlinks too, so a symlinked readme.txt would never be released. + if [ -L readme.txt ]; then + echo "❌ readme.txt must be a regular file, not a symlink" + exit 1 + fi + if [ ! -f readme.txt ]; then echo "❌ readme.txt not found" exit 1 @@ -177,6 +185,15 @@ jobs: exit 1 fi + # The input check only rejects '..'. ASSETS_DIR or one of its parents could still be a symlink + # that points outside the repository, and rsync would publish whatever is there. + REAL_ASSETS_DIR=$(realpath -e "$ASSETS_DIR") + REAL_WORKSPACE=$(realpath -e "$GITHUB_WORKSPACE") + if [[ "$REAL_ASSETS_DIR/" != "$REAL_WORKSPACE/"* ]]; then + echo "❌ Assets directory resolves to a path outside the repository: $ASSETS_DIR -> $REAL_ASSETS_DIR" + exit 1 + fi + ERRORS=0 # Symlinks would be skipped by rsync and silently leave the old file in SVN, diff --git a/docs/wordpress-org-plugin-page.md b/docs/wordpress-org-plugin-page.md index 5a29751d7..c25b54098 100644 --- a/docs/wordpress-org-plugin-page.md +++ b/docs/wordpress-org-plugin-page.md @@ -15,8 +15,8 @@ To ship new plugin code, use [WordPress.org Release](./wordpress-org-release.md) To achieve that, this workflow: 1. Checks out the Git repository at `GIT_REF` -2. When `SYNC_README` is enabled, reads the `Stable tag` from `readme.txt` -3. When `SYNC_ASSETS` is enabled, validates every file in `ASSETS_DIR` (names, size limits, real image format and dimensions, blueprint JSON), and fails if the directory is missing or empty, or contains symlinks or unsupported subdirectories +2. When `SYNC_README` is enabled, reads the `Stable tag` from `readme.txt`, which must be a regular file, not a symlink +3. When `SYNC_ASSETS` is enabled, validates every file in `ASSETS_DIR` (names, size limits, real image format and dimensions, blueprint JSON), and fails if the directory is missing or empty, resolves to a path outside the repository, or contains symlinks or unsupported subdirectories 4. Checks out only the needed parts of the WordPress.org SVN repository: `trunk/readme.txt`, the list of tags, the readme of the stable tag, and `/assets`. Plugin code is never fetched 5. Verifies that the `Stable tag` in Git equals the `Stable tag` in SVN trunk and that this tag exists 6. Copies `readme.txt` into `tags//` (which is what WordPress.org renders) and into `trunk/`. The trunk copy is skipped with a warning if trunk contains unreleased changes, see [Trunk previews](#trunk-previews). A warning is also shown if `Requires at least` or `Requires PHP` changes: unless the main plugin file declares them, WordPress uses these values to block installs and updates of the published version on sites that don't meet them. A notice and the job summary remind about [Release Confirmation](#release-confirmation) whenever the tag's `readme.txt` changes From 9fbcb39384ef5b51d66bab1328c8ab6948766d58 Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Mon, 23 Nov 2026 20:02:12 +0200 Subject: [PATCH 30/34] Fail on ambiguous Stable tag in readme.txt The workflow parsed readme headers three times with grep -m1, which reads the first match anywhere in the file. A second Stable tag line, or one outside the header, made it write the readme to a tag WordPress.org doesn't serve, and the run still succeeded. Use one shared parser that prints every header match before the first == Section ==, and require exactly one Stable tag in Git and in SVN trunk. Rather than copying WordPress.org's readme parser, which can change, any ambiguous readme fails before anything is committed. Multiple Requires values are joined into one line, so readme content can't start a workflow command in the ::warning output. --- .../workflows/wordpress-org-plugin-page.yml | 39 +++++++++++++++---- docs/wordpress-org-plugin-page.md | 2 +- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/.github/workflows/wordpress-org-plugin-page.yml b/.github/workflows/wordpress-org-plugin-page.yml index 0cb197cee..899a88095 100644 --- a/.github/workflows/wordpress-org-plugin-page.yml +++ b/.github/workflows/wordpress-org-plugin-page.yml @@ -62,6 +62,20 @@ jobs: ICON_RE: '^icon-(128x128|256x256)(-rtl)?(-[a-z]{2,3}(_[a-z]{2})?(_[a-z0-9]+)?)?\.(png|jpg|jpeg|gif)$' SCREENSHOT_RE: '^screenshot-[0-9]+(-rtl)?(-[a-z]{2,3}(_[a-z]{2})?(_[a-z0-9]+)?)?\.(png|jpg|jpeg|gif)$' BLUEPRINT_RE: '^blueprints/blueprint[-A-Za-z0-9_]*\.json$' + # Prints the value of every readme.txt header line with the given key, one per line. Only lines before the + # first == Section == count. The key is case-insensitive, and spaces, "*" and "-" around key and value are ignored. + # Callers decide what zero or several matches mean, so an ambiguous readme fails instead of guessing + # which value WordPress.org would use. Usage: awk -v key="stable tag" "$README_HEADER_AWK" readme.txt + README_HEADER_AWK: | + { sub(/\r$/, "") } + /^==[^=]/ { exit } + index($0, ":") { + k = tolower(substr($0, 1, index($0, ":") - 1)) + v = substr($0, index($0, ":") + 1) + gsub(/^[ \t*-]+|[ \t*-]+$/, "", k) + gsub(/^[ \t*-]+|[ \t*-]+$/, "", v) + if (k == tolower(key)) print v + } steps: - name: Install required tools env: @@ -148,11 +162,16 @@ jobs: exit 1 fi - STABLE_TAG=$(grep -m1 -iE '^[[:space:]]*([*+-][[:space:]]+)?Stable tag:' readme.txt \ - | sed -E 's/^.*Stable tag:[[:space:]]*//I; s/[[:space:]]+$//' | tr -d '\r' || true) + # The Stable tag decides which SVN tag gets the readme, so anything ambiguous fails. + mapfile -t STABLE_TAGS < <(awk -v key="stable tag" "$README_HEADER_AWK" readme.txt) + if [ "${#STABLE_TAGS[@]}" -ne 1 ]; then + echo "❌ readme.txt must have exactly one 'Stable tag:' line before the first == Section ==, found ${#STABLE_TAGS[@]}" + exit 1 + fi + STABLE_TAG="${STABLE_TAGS[0]}" if [ -z "$STABLE_TAG" ]; then - echo "❌ Could not extract 'Stable tag:' from readme.txt" + echo "❌ 'Stable tag:' in readme.txt is empty" exit 1 fi @@ -380,8 +399,13 @@ jobs: exit 1 fi - SVN_STABLE_TAG=$(grep -m1 -iE '^[[:space:]]*([*+-][[:space:]]+)?Stable tag:' trunk/readme.txt \ - | sed -E 's/^.*Stable tag:[[:space:]]*//I; s/[[:space:]]+$//' | tr -d '\r' || true) + mapfile -t SVN_STABLE_TAGS < <(awk -v key="stable tag" "$README_HEADER_AWK" trunk/readme.txt) + if [ "${#SVN_STABLE_TAGS[@]}" -ne 1 ]; then + echo "❌ trunk/readme.txt in SVN must have exactly one 'Stable tag:' line before the first == Section ==, found ${#SVN_STABLE_TAGS[@]}" + echo " Fix trunk/readme.txt in SVN first, e.g. with the next release." + exit 1 + fi + SVN_STABLE_TAG="${SVN_STABLE_TAGS[0]}" # Changing the Stable tag means publishing a different version - that is a release. if [ "$STABLE_TAG" != "$SVN_STABLE_TAG" ]; then @@ -410,9 +434,10 @@ jobs: GIT_README="$GITHUB_WORKSPACE/readme.txt" TAG_README="tags/$STABLE_TAG/readme.txt" + # Several matches are joined into one line: the value ends up in a ::warning, and a line break would let + # readme.txt start its own workflow command on the next line. readme_header() { - grep -m1 -iE "^[[:space:]]*([*+-][[:space:]]+)?$1:" "$2" \ - | sed -E 's/^[^:]*:[[:space:]]*//; s/[[:space:]]+$//' | tr -d '\r' || true + awk -v key="$1" "$README_HEADER_AWK" "$2" | paste -sd ',' - } # Unlike the rest of readme.txt, these headers aren't just displayed: unless the main plugin file diff --git a/docs/wordpress-org-plugin-page.md b/docs/wordpress-org-plugin-page.md index c25b54098..ba40de8aa 100644 --- a/docs/wordpress-org-plugin-page.md +++ b/docs/wordpress-org-plugin-page.md @@ -15,7 +15,7 @@ To ship new plugin code, use [WordPress.org Release](./wordpress-org-release.md) To achieve that, this workflow: 1. Checks out the Git repository at `GIT_REF` -2. When `SYNC_README` is enabled, reads the `Stable tag` from `readme.txt`, which must be a regular file, not a symlink +2. When `SYNC_README` is enabled, reads the `Stable tag` from `readme.txt`. The file must be a regular file (not a symlink) and have exactly one `Stable tag:` line before the first `== Section ==` 3. When `SYNC_ASSETS` is enabled, validates every file in `ASSETS_DIR` (names, size limits, real image format and dimensions, blueprint JSON), and fails if the directory is missing or empty, resolves to a path outside the repository, or contains symlinks or unsupported subdirectories 4. Checks out only the needed parts of the WordPress.org SVN repository: `trunk/readme.txt`, the list of tags, the readme of the stable tag, and `/assets`. Plugin code is never fetched 5. Verifies that the `Stable tag` in Git equals the `Stable tag` in SVN trunk and that this tag exists From 156278c74df880ab723ce65851293a3c4038098b Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Mon, 23 Nov 2026 20:11:04 +0200 Subject: [PATCH 31/34] Explain SVN commit timeouts in the plugin page workflow WordPress.org can still be busy in "Committing transaction..." when svn's HTTP timeout runs out, failing with E175012 while the commit goes through. Unlike in the release workflow, where #300 raised the timeout because a timeout leaves the release half done, a re-run here is always safe and small plugin page commits rarely take that long. So keep the default timeout and say that the commit may have gone through and a re-run shows whether it did. --- .github/workflows/wordpress-org-plugin-page.yml | 3 +++ docs/wordpress-org-plugin-page.md | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/wordpress-org-plugin-page.yml b/.github/workflows/wordpress-org-plugin-page.yml index 899a88095..5e6bb47e3 100644 --- a/.github/workflows/wordpress-org-plugin-page.yml +++ b/.github/workflows/wordpress-org-plugin-page.yml @@ -751,6 +751,9 @@ jobs: -m "$COMMIT_MESSAGE" 2>&1 | tee "$COMMIT_LOG"; then if grep -qE 'E160028|E160024|out of date' "$COMMIT_LOG"; then echo "::error title=Concurrent SVN commit::Someone else committed to this plugin on WordPress.org in the meantime (maybe a release running at the same time). Nothing was changed. Re-run this workflow once the other run has finished." + elif grep -q 'E175012' "$COMMIT_LOG"; then + # The server can still be busy in "Committing transaction..." when svn's HTTP timeout runs out. + echo "::error title=SVN commit timed out::WordPress.org didn't confirm the commit in time, but it may still have gone through. Re-run this workflow: it either reports that the plugin page is already up to date or commits the changes." fi exit 1 fi diff --git a/docs/wordpress-org-plugin-page.md b/docs/wordpress-org-plugin-page.md index ba40de8aa..300c64179 100644 --- a/docs/wordpress-org-plugin-page.md +++ b/docs/wordpress-org-plugin-page.md @@ -250,4 +250,4 @@ If nothing would change, no artifact is uploaded and the job summary says that t ## Troubleshooting -Changes are committed in a single atomic SVN commit, and a run without changes succeeds. If a run fails, even in the commit step because of a network error, **Re-run failed jobs** is always safe. The re-run either commits the changes or reports that the plugin page is already up to date, so there is no need to fix anything in SVN by hand. If the commit failed because someone else committed in the meantime (e.g. a release running at the same time), wait until that run has finished. If that was a release, the re-run fails the Stable tag check instead, because the release published a new version: run the workflow again with a `GIT_REF` that matches it. If `GIT_REF` is a branch, a re-run uses its current state, which may include newer commits. +Changes are committed in a single atomic SVN commit, and a run without changes succeeds. If a run fails, even in the commit step because of a network error or a timeout, **Re-run failed jobs** is always safe. The re-run either commits the changes or reports that the plugin page is already up to date, so there is no need to fix anything in SVN by hand. If the commit failed because someone else committed in the meantime (e.g. a release running at the same time), wait until that run has finished. If that was a release, the re-run fails the Stable tag check instead, because the release published a new version: run the workflow again with a `GIT_REF` that matches it. If `GIT_REF` is a branch, a re-run uses its current state, which may include newer commits. From cd85118c17aebd23d0244da4e8274fd5e7d9e4fa Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Mon, 23 Nov 2026 20:16:56 +0200 Subject: [PATCH 32/34] Reuse the shared asset patterns in the remove-all guard count_assets had its own copies of the icon, banner, and screenshot patterns, although the job env comment says they're shared so they can't drift apart. Match against ICON_RE, BANNER_RE, and SCREENSHOT_RE instead, and count only default assets: every locale suffix starts with "-", so a default name has exactly one "-" before the extension. The result is the same as before for every combination of type, name, suffix, and extension tested. --- .github/workflows/wordpress-org-plugin-page.yml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/wordpress-org-plugin-page.yml b/.github/workflows/wordpress-org-plugin-page.yml index 5e6bb47e3..8b58c5581 100644 --- a/.github/workflows/wordpress-org-plugin-page.yml +++ b/.github/workflows/wordpress-org-plugin-page.yml @@ -556,16 +556,21 @@ jobs: mapfile -t REMAINING < <(cd assets && find . -type f ! -path '*/.*' -printf '%P\n') # Only default assets count: localized ones (-rtl, -de, ...) are shown just for those locales. + # The shared patterns also match localized names. Every locale suffix starts with "-", so a default + # name has exactly one "-" before the extension (icon-128x128.png, screenshot-1.png). count_assets() { - local TYPE="$1" COUNT=0 NAME LOWER + local TYPE="$1" COUNT=0 NAME LOWER RE shift + case "$TYPE" in + icon) RE="$ICON_RE" ;; + banner) RE="$BANNER_RE" ;; + screenshot) RE="$SCREENSHOT_RE" ;; + esac for NAME in "$@"; do LOWER="${NAME,,}" - case "$TYPE" in - icon) [[ "$LOWER" =~ ^icon-(128x128|256x256)\.(png|jpg|jpeg|gif)$ || "$NAME" = "icon.svg" ]] ;; - banner) [[ "$LOWER" =~ ^banner-(772x250|1544x500)\.(png|jpg|jpeg|gif)$ ]] ;; - screenshot) [[ "$LOWER" =~ ^screenshot-[0-9]+\.(png|jpg|jpeg|gif)$ ]] ;; - esac && COUNT=$((COUNT + 1)) + if [[ ( "$LOWER" =~ $RE && "${LOWER%.*}" != *-*-* ) || ( "$TYPE" = "icon" && "$NAME" = "icon.svg" ) ]]; then + COUNT=$((COUNT + 1)) + fi done echo "$COUNT" } From 51ce4e9d0147418485604712bc4b1b826e2de9da Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Mon, 23 Nov 2026 20:19:00 +0200 Subject: [PATCH 33/34] Make the job summary show whether anything was published - Mark the SVN changes of a dry run as not committed. - Link the changeset on plugins.trac.wordpress.org after a live commit. - Say "already up to date" instead of "Updated" for readmes that don't change. - Skip the readme.txt diff section when the diff is empty. --- .../workflows/wordpress-org-plugin-page.yml | 42 +++++++++++++++---- docs/wordpress-org-plugin-page.md | 2 +- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/.github/workflows/wordpress-org-plugin-page.yml b/.github/workflows/wordpress-org-plugin-page.yml index 8b58c5581..35cb5e463 100644 --- a/.github/workflows/wordpress-org-plugin-page.yml +++ b/.github/workflows/wordpress-org-plugin-page.yml @@ -475,14 +475,18 @@ jobs: fi # The plugin page is rendered from the readme.txt of the Stable tag. - cp "$GIT_README" "$TAG_README" - echo "✅ Updated $TAG_README" + if cmp -s "$GIT_README" "$TAG_README"; then + echo "ℹ️ $TAG_README is already up to date" + else + cp "$GIT_README" "$TAG_README" + echo "✅ Updated $TAG_README" + fi - if [ "$TRUNK_IN_SYNC" = "true" ]; then + if cmp -s trunk/readme.txt "$GIT_README"; then + echo "ℹ️ trunk/readme.txt is already up to date" + elif [ "$TRUNK_IN_SYNC" = "true" ]; then cp "$GIT_README" trunk/readme.txt echo "✅ Updated trunk/readme.txt" - elif cmp -s trunk/readme.txt "$GIT_README"; then - echo "ℹ️ trunk/readme.txt already matches readme.txt from Git" else echo "::warning title=trunk/readme.txt left unchanged::SVN trunk contains unreleased readme.txt changes (likely a trunk preview). Only $TAG_README was updated. Make sure the same change is part of the upcoming release." @@ -660,6 +664,7 @@ jobs: - name: Show SVN changes id: svn_status env: + DRY_RUN: ${{ inputs.DRY_RUN }} SYNC_README: ${{ inputs.SYNC_README }} SYNC_ASSETS: ${{ inputs.SYNC_ASSETS }} STABLE_TAG: ${{ steps.readme.outputs.STABLE_TAG }} @@ -696,9 +701,19 @@ jobs: DELETED=$(grep '^D' <<< "$STATUS" | cut -c9- || true) + README_DIFF="" + if [ "${#README_PATHS[@]}" -gt 0 ]; then + README_DIFF=$(svn diff "${README_PATHS[@]}") + fi + # Readme files may contain ``` themselves, so a longer fence is used. { - echo '### SVN changes' + # Dry and live runs show the same changes, so the heading says whether they were committed. + if [ "$DRY_RUN" = "true" ]; then + echo '### SVN changes (dry run, nothing committed)' + else + echo '### SVN changes' + fi echo '`````' echo "$STATUS" echo '`````' @@ -711,10 +726,10 @@ jobs: fi # Readme diffs are text and worth reviewing; binary assets are listed by status only. - if [ "${#README_PATHS[@]}" -gt 0 ]; then + if [ -n "$README_DIFF" ]; then echo '### readme.txt diff' echo '`````diff' - svn diff "${README_PATHS[@]}" + echo "$README_DIFF" echo '`````' fi } | tee -a "$GITHUB_STEP_SUMMARY" @@ -724,6 +739,7 @@ jobs: env: SVN_USERNAME: ${{ secrets.SVN_USERNAME }} SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} + SVN_PLUGIN_SLUG: ${{ inputs.SVN_PLUGIN_SLUG }} GIT_REF: ${{ inputs.GIT_REF }} SHORT_SHA: ${{ steps.git_revision.outputs.SHORT_SHA }} HAS_CHANGES: ${{ steps.svn_status.outputs.HAS_CHANGES }} @@ -763,7 +779,15 @@ jobs: exit 1 fi - echo "✅ WordPress.org plugin page updated. Changes may take a few minutes (up to hours) to show due to CDN caching." + REVISION=$(grep -oP 'Committed revision \K[0-9]+' "$COMMIT_LOG" || true) + { + if [ -n "$REVISION" ]; then + echo "✅ Committed [r$REVISION](https://plugins.trac.wordpress.org/changeset/$REVISION) to WordPress.org." + else + echo "✅ Committed to WordPress.org." + fi + echo "The [plugin page](https://wordpress.org/plugins/$SVN_PLUGIN_SLUG/) may take a few minutes (up to hours) to show the changes due to CDN caching." + } | tee -a "$GITHUB_STEP_SUMMARY" - name: Prepare dry run preview if: inputs.DRY_RUN == true && steps.svn_status.outputs.HAS_CHANGES == 'true' diff --git a/docs/wordpress-org-plugin-page.md b/docs/wordpress-org-plugin-page.md index 300c64179..0cbe0491b 100644 --- a/docs/wordpress-org-plugin-page.md +++ b/docs/wordpress-org-plugin-page.md @@ -23,7 +23,7 @@ To achieve that, this workflow: 7. Mirrors `ASSETS_DIR` to SVN `/assets` via `rsync --delete`, so files removed from Git are removed from WordPress.org as well, and sets the correct `svn:mime-type` on every image (blueprints get none, so SVN keeps treating them as text). Fails if this would remove the last icon or banner from the plugin page, and warns if it removes all screenshots 8. Fails if anything would change that the enabled options don't allow: `trunk/readme.txt` and `tags//readme.txt` with `SYNC_README`, and recognized asset files in `/assets` with `SYNC_ASSETS` 9. Shows the `svn status`, the removed files, and the `readme.txt` diff in the log and in the job summary on the run page -10. Commits all changes in a single SVN commit (or uploads them as an artifact in `DRY_RUN` mode). If nothing changed, the workflow ends successfully without committing +10. Commits all changes in a single SVN commit and links it in the job summary (or uploads them as an artifact in `DRY_RUN` mode). If nothing changed, the workflow ends successfully without committing > [!IMPORTANT] > This workflow never creates tags, never changes the `Stable tag`, and never touches plugin code. Changing the `Stable tag` means publishing a different version, which is a release. From aebedd1b2e7a1b9d430244e55a5bfe9ca07a409e Mon Sep 17 00:00:00 2001 From: Kyrylo Date: Mon, 23 Nov 2026 20:20:12 +0200 Subject: [PATCH 34/34] Reorganize plugin page docs around everyday tasks - Replace the ten implementation steps with four short ones; the details are in the sections below. - Add a "Common tasks" table and an example that publishes the assets right after every release. - Turn troubleshooting into a list of symptoms and fixes. - Mention that GIT_REF also accepts pull request refs, so even a fork's pull request can be published. - Explain how to export the assets into an existing directory. --- docs/wordpress-org-plugin-page.md | 75 +++++++++++++++++++++++++------ 1 file changed, 61 insertions(+), 14 deletions(-) diff --git a/docs/wordpress-org-plugin-page.md b/docs/wordpress-org-plugin-page.md index 0cbe0491b..92caaac06 100644 --- a/docs/wordpress-org-plugin-page.md +++ b/docs/wordpress-org-plugin-page.md @@ -10,20 +10,14 @@ Use it for changes like: - temporarily swapping a banner (e.g. for a campaign) and reverting it later - refreshing screenshots or adding a Playground preview blueprint -To ship new plugin code, use [WordPress.org Release](./wordpress-org-release.md) instead. That workflow also publishes `readme.txt` as part of every release, so both workflows keep the plugin page in sync with Git. +To ship new plugin code, use [WordPress.org Release](./wordpress-org-release.md) instead. That workflow also publishes `readme.txt` as part of every release, but not the assets, see [Common tasks](#common-tasks). -To achieve that, this workflow: +How it works: -1. Checks out the Git repository at `GIT_REF` -2. When `SYNC_README` is enabled, reads the `Stable tag` from `readme.txt`. The file must be a regular file (not a symlink) and have exactly one `Stable tag:` line before the first `== Section ==` -3. When `SYNC_ASSETS` is enabled, validates every file in `ASSETS_DIR` (names, size limits, real image format and dimensions, blueprint JSON), and fails if the directory is missing or empty, resolves to a path outside the repository, or contains symlinks or unsupported subdirectories -4. Checks out only the needed parts of the WordPress.org SVN repository: `trunk/readme.txt`, the list of tags, the readme of the stable tag, and `/assets`. Plugin code is never fetched -5. Verifies that the `Stable tag` in Git equals the `Stable tag` in SVN trunk and that this tag exists -6. Copies `readme.txt` into `tags//` (which is what WordPress.org renders) and into `trunk/`. The trunk copy is skipped with a warning if trunk contains unreleased changes, see [Trunk previews](#trunk-previews). A warning is also shown if `Requires at least` or `Requires PHP` changes: unless the main plugin file declares them, WordPress uses these values to block installs and updates of the published version on sites that don't meet them. A notice and the job summary remind about [Release Confirmation](#release-confirmation) whenever the tag's `readme.txt` changes -7. Mirrors `ASSETS_DIR` to SVN `/assets` via `rsync --delete`, so files removed from Git are removed from WordPress.org as well, and sets the correct `svn:mime-type` on every image (blueprints get none, so SVN keeps treating them as text). Fails if this would remove the last icon or banner from the plugin page, and warns if it removes all screenshots -8. Fails if anything would change that the enabled options don't allow: `trunk/readme.txt` and `tags//readme.txt` with `SYNC_README`, and recognized asset files in `/assets` with `SYNC_ASSETS` -9. Shows the `svn status`, the removed files, and the `readme.txt` diff in the log and in the job summary on the run page -10. Commits all changes in a single SVN commit and links it in the job summary (or uploads them as an artifact in `DRY_RUN` mode). If nothing changed, the workflow ends successfully without committing +- **Validate:** with `SYNC_README`, `readme.txt` must be a regular file (not a symlink) with exactly one `Stable tag:` line before the first `== Section ==`. With `SYNC_ASSETS`, every file in `ASSETS_DIR` must be a [supported asset](#supported-asset-files). +- **Check the version:** with `SYNC_README`, the `Stable tag` in Git must equal the one in SVN trunk, and that tag must exist. Only `trunk/readme.txt`, the tag's `readme.txt`, and `/assets` are checked out from SVN, never plugin code. +- **Sync:** `readme.txt` is copied into `tags//` (which WordPress.org renders) and `trunk/`, see [Trunk previews](#trunk-previews) and [Release Confirmation](#release-confirmation). `ASSETS_DIR` is mirrored to `/assets`, so files removed from Git are removed from WordPress.org too. The run fails if it would remove the last icon or banner, or change anything other than these files, and warns if it removes all screenshots. +- **Publish:** the changes are shown in the job summary, then committed in a single SVN commit, or uploaded as an artifact in a [dry run](#dry-run). A run without changes succeeds without committing. > [!IMPORTANT] > This workflow never creates tags, never changes the `Stable tag`, and never touches plugin code. Changing the `Stable tag` means publishing a different version, which is a release. @@ -31,6 +25,9 @@ To achieve that, this workflow: > [!NOTE] > WordPress.org renders the plugin page from the `readme.txt` in the tag that `Stable tag` points to, not from trunk. The WordPress.org [plugin developer FAQ](https://developer.wordpress.org/plugins/wordpress-org/plugin-developer-faq/#do-i-need-to-release-a-new-version-of-my-plugin-every-time-i-update-the-readme) explicitly allows cosmetic readme and asset changes without a new release, as long as both trunk and the tag are updated. +> [!NOTE] +> `Requires at least` and `Requires PHP` in `readme.txt` aren't just displayed: unless the main plugin file declares them, WordPress uses them to block installs and updates of the published version on sites that don't meet them. The workflow warns when a run changes them. + > [!NOTE] > Assets are served through a CDN and cached heavily. Changes can take a few minutes, and under high load up to several hours, to show up on the plugin page. @@ -97,6 +94,46 @@ git push -u origin HEAD > [!WARNING] > A development branch is risky as `GIT_REF`. Until the next release, its `Stable tag` usually still names the published version, so the Stable tag check passes. But its `readme.txt` may already contain a changelog entry, upgrade notice, or FAQ entries for the next version, and its assets may include screenshots of unreleased features. The workflow publishes all of it without a warning. +## Common tasks + +Make each change on a branch created as described in [Choosing `GIT_REF`](#choosing-git_ref), and check the dry run before publishing. + +| Task | Change on the branch | `SYNC_README` | `SYNC_ASSETS` | +|---|---|---|---| +| Bump `Tested up to`, add or remove a promo link | `readme.txt` | `true` | `false` | +| Campaign banner | Replace `banner-*.png` in `.wordpress-org/` | `false` | `true` | +| Revert the campaign banner | `git revert` the banner commit, and merge the revert into your development branch too | `false` | `true` | +| New screenshots | `screenshot-N.png` and its caption in `== Screenshots ==` | `true` | `true` | +| Playground preview | Add `blueprints/blueprint.json`, then make the preview public in the plugin's **Advanced View** | `false` | `true` | +| Keep assets current after each release | None, see below | `false` | `true` | + +The release workflow doesn't publish `.wordpress-org/` (it's excluded via `.distignore`, see [Adopting the workflow](#adopting-the-workflow)), so assets changed in Git only reach WordPress.org with this workflow. To publish them with every release, run it right after the release: + +```yml +jobs: + release: + uses: inpsyde/reusable-workflows/.github/workflows/wordpress-org-release.yml@main + with: + SVN_PLUGIN_SLUG: my-plugin + PLUGIN_VERSION: ${{ inputs.PLUGIN_VERSION }} + GIT_REF: ${{ inputs.GIT_REF }} + UPDATE_TRUNK_ONLY: false + secrets: + SVN_USERNAME: ${{ secrets.SVN_USERNAME }} + SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} + plugin-page: + needs: release + uses: inpsyde/reusable-workflows/.github/workflows/wordpress-org-plugin-page.yml@main + with: + SVN_PLUGIN_SLUG: my-plugin + GIT_REF: ${{ inputs.GIT_REF }} + SYNC_README: false # the release already published readme.txt + DRY_RUN: false + secrets: + SVN_USERNAME: ${{ secrets.SVN_USERNAME }} + SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} +``` + ## Advanced usage: requiring manual approval To require approval before the plugin page is updated, add an `environment:` key to the calling job and configure protection rules (required reviewers, wait timers, etc.) for that environment in your repository settings under **Settings → Environments**. @@ -119,7 +156,7 @@ jobs: > The `environment:` key alone does nothing: protection rules must be explicitly configured in repository settings. An environment with no rules configured provides no approval gate. > [!WARNING] -> An environment's **deployment branch** rule restricts the ref the *calling* workflow runs from, not `GIT_REF`. With `GIT_REF` as a free-text input, anyone allowed to run the workflow can publish the readme and assets from any branch, regardless of the environment rule. If you rely on branch rules, pass `${{ github.sha }}` or `${{ github.ref_name }}` as `GIT_REF`, or offer a `choice` input instead. +> An environment's **deployment branch** rule restricts the ref the *calling* workflow runs from, not `GIT_REF`. With `GIT_REF` as a free-text input, anyone allowed to run the workflow can publish the readme and assets from any branch, regardless of the environment rule. This includes pull request refs like `refs/pull//head`, so even a fork's pull request can be published. If you rely on branch rules, pass `${{ github.sha }}` or `${{ github.ref_name }}` as `GIT_REF`, or offer a `choice` input instead. To use a branch created as described in [Choosing `GIT_REF`](#choosing-git_ref), run the calling workflow from that branch with `GIT_REF: ${{ github.sha }}`, and allow only `plugin-page/*` branches, with `if:` as below or with the environment's deployment branch rule. Both only check the branch name, not what the branch contains, so check the dry run either way. @@ -155,6 +192,8 @@ Assets are mirrored, so the assets directory in Git must contain **every** asset svn export https://plugins.svn.wordpress.org/my-plugin/assets .wordpress-org ``` +If `.wordpress-org` already exists, add `--force` to export into it. + Then: 1. Commit the `.wordpress-org` directory. Don't store it in Git LFS, see [Supported asset files](#supported-asset-files). @@ -250,4 +289,12 @@ If nothing would change, no artifact is uploaded and the job summary says that t ## Troubleshooting -Changes are committed in a single atomic SVN commit, and a run without changes succeeds. If a run fails, even in the commit step because of a network error or a timeout, **Re-run failed jobs** is always safe. The re-run either commits the changes or reports that the plugin page is already up to date, so there is no need to fix anything in SVN by hand. If the commit failed because someone else committed in the meantime (e.g. a release running at the same time), wait until that run has finished. If that was a release, the re-run fails the Stable tag check instead, because the release published a new version: run the workflow again with a `GIT_REF` that matches it. If `GIT_REF` is a branch, a re-run uses its current state, which may include newer commits. +Changes are committed in a single atomic SVN commit, so **Re-run failed jobs** is always safe: the re-run either commits the changes or reports that the plugin page is already up to date. There is no need to fix anything in SVN by hand. If `GIT_REF` is a branch, a re-run uses its current state, which may include newer commits. + +- **Stable tag mismatch:** `readme.txt` in `GIT_REF` doesn't describe the published version, e.g. it comes from a development branch or a release happened since. See [Choosing `GIT_REF`](#choosing-git_ref). +- **"Exactly one 'Stable tag:' line":** remove duplicate `Stable tag:` lines, or move the line into the header before the first `== Section ==`. +- **Asset rejected:** the log says why. See [Supported asset files](#supported-asset-files) for names, formats, sizes, and dimensions. +- **Concurrent SVN commit:** someone else committed in the meantime, e.g. a release. Wait until that run has finished, then re-run. If it was a release, the re-run fails the Stable tag check: run the workflow again with a `GIT_REF` that matches the new version. +- **SVN commit timed out, or a network error:** the commit may still have gone through. Re-run to find out. +- **trunk/readme.txt left unchanged:** trunk holds unreleased changes, see [Trunk previews](#trunk-previews). +- **Plugin page not updated:** wait for the CDN cache (minutes, sometimes hours). With [Release Confirmation](#release-confirmation), the release must be confirmed again first.