Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/scripts/sync-readme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash
set -euo pipefail

# Only update an existing release; never create or switch the stable tag.
read_stable_tag() {
sed -nE 's/^[Ss][Tt][Aa][Bb][Ll][Ee] [Tt][Aa][Gg]:[[:space:]]*([^[:space:]]+)[[:space:]]*$/\1/p' "$1"
}

stable_tag=$(read_stable_tag readme.txt)
if [[ ! "$stable_tag" =~ ^[0-9]+(\.[0-9]+)*$ ]]; then
echo 'Expected one numeric Stable Tag in readme.txt.' >&2
exit 1
fi

svn_url='https://plugins.svn.wordpress.org/aaa-option-optimizer'
svn_dir=$(mktemp -d)
trap 'rm -rf "$svn_dir"' EXIT

svn checkout --non-interactive --depth empty "$svn_url" "$svn_dir"
svn update --non-interactive --depth empty "$svn_dir/trunk" "$svn_dir/tags"
svn update --non-interactive --depth empty "$svn_dir/tags/$stable_tag"
svn update --non-interactive "$svn_dir/trunk/readme.txt" "$svn_dir/tags/$stable_tag/readme.txt"

for target in "$svn_dir/trunk/readme.txt" "$svn_dir/tags/$stable_tag/readme.txt"; do
if [[ ! -f "$target" ]] || [[ "$(read_stable_tag "$target")" != "$stable_tag" ]]; then
echo 'The local Stable Tag must match the published trunk and tag readmes.' >&2
exit 1
fi
done

cp readme.txt "$svn_dir/trunk/readme.txt"
cp readme.txt "$svn_dir/tags/$stable_tag/readme.txt"

if [[ -z "$(svn status "$svn_dir")" ]]; then
echo 'Both published readmes are already up to date.'
exit 0
fi

svn diff "$svn_dir"
if [[ "${DRY_RUN:-false}" == 'true' ]]; then
echo 'Dry run: no files were committed.'
exit 0
fi

: "${SVN_USERNAME:?SVN_USERNAME is required}"
: "${SVN_PASSWORD:?SVN_PASSWORD is required}"
svn_auth=(--username "$SVN_USERNAME" --password "$SVN_PASSWORD" --non-interactive --no-auth-cache)
svn commit "$svn_dir/trunk/readme.txt" "$svn_dir/tags/$stable_tag/readme.txt" \
--message "Update aaa-option-optimizer readme.txt for $stable_tag" "${svn_auth[@]}"
33 changes: 33 additions & 0 deletions .github/workflows/readme-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Sync readme.txt to WordPress.org

# The plugin directory reads metadata from the stable tag's readme.
# Update trunk and that tag together without publishing plugin code.
on:
workflow_dispatch:

permissions:
contents: read

concurrency:
group: wordpress-org-aaa-option-optimizer
cancel-in-progress: false

jobs:
sync-readme:
name: Sync readme.txt to SVN trunk and stable tag
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Install Subversion
run: sudo apt-get update && sudo apt-get install -y subversion

- name: Sync published readmes
env:
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
run: bash .github/scripts/sync-readme.sh
2 changes: 2 additions & 0 deletions aaa-option-optimizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* Plugin URI: https://progressplanner.com/plugins/aaa-option-optimizer/
* Description: Tracks autoloaded options usage and allows the user to optimize them.
* Version: 1.7.1
* Requires at least: 6.7
* Requires PHP: 7.4
* License: GPL-3.0+
* Author: Team Progress Planner
* Author URI: https://progressplanner.com/
Expand Down
4 changes: 2 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Contributors: joostdevalk, aristath, filipi, progressplanner
Tags: autoload, options, database, performance, cleanup
Requires at least: 6.7
Tested up to: 7.1
Tested up to: 7.2
Stable tag: 1.7.1
Requires PHP: 7.4
License: GPL-3.0-or-later
Expand All @@ -24,7 +24,7 @@ or turn off autoloading.

== How It Works ==

1. Install the plugin and browse your site normally for a few days.
1. Install and activate the plugin, then browse your site normally for a few days.
2. The plugin quietly records which autoloaded options are actually used
during page rendering.
3. Visit the settings screen to see every autoloaded option that was
Expand Down
Loading