Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add generate-pending-release-diffs command #1227

Merged
merged 3 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
59 changes: 59 additions & 0 deletions bin/generate-pending-release-diffs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash
# Generate an overview of the plugin changes between the local filesystem and the latest stable (trunk) versions
# committed to SVN in the WordPress.org Plugin Directory. The output is in Markdown format which is suitable for
# pasting into a GitHub release preparation PR. Program status updates are sent to STDERR, so STDOUT can be piped
# either to the clipboard or to a file for posting to GitHub.
#
# USAGE:
# ./generate-pending-release-diffs.sh > overview.md
# ./generate-pending-release-diffs.sh | pbcopy
# npm run generate-pending-release-diffs --silent

set -e

for required_command in npm git svn jq rsync; do
if ! command -v "$required_command" &> /dev/null; then
echo "Error: The $required_command command must be installed to use this script." >&2
exit 1
fi
done

cd "$(git rev-parse --show-toplevel)"

npm run build:plugin:performance-lab >&2 # TODO: Remove this as of <https://github.com/WordPress/performance/pull/1182>.
westonruter marked this conversation as resolved.
Show resolved Hide resolved
npm run build-plugins >&2

stable_dir=/tmp/stable-svn
mkdir -p "$stable_dir"
for plugin_slug in $(jq '.plugins[]' -r plugins.json) 'performance-lab'; do
westonruter marked this conversation as resolved.
Show resolved Hide resolved
echo "# $plugin_slug ###############################" >&2
if [ ! -d "$stable_dir/$plugin_slug" ]; then
svn co "https://plugins.svn.wordpress.org/$plugin_slug/trunk/" "$stable_dir/$plugin_slug" >&2
else
svn revert "$stable_dir/$plugin_slug" >&2
svn up "$stable_dir/$plugin_slug" >&2
fi

rsync -avz --delete --exclude=".svn" "build/$plugin_slug/" "$stable_dir/$plugin_slug/" >&2

cd "$stable_dir/$plugin_slug/"

echo "# \`$plugin_slug\`"
echo
echo "\`svn status\`:"
echo '```'
svn status
echo '```'
echo
echo '<details><summary><code>svn diff</code></summary>'
echo
echo '```diff'
svn diff
echo '```'
echo '</details>'
echo

cd - > /dev/null

echo >&2
done
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"build:plugin:optimization-detective": "webpack --mode production --env plugin=optimization-detective",
"build:plugin:speculation-rules": "webpack --mode production --env plugin=speculation-rules",
"build:plugin:webp-uploads": "webpack --mode production --env plugin=webp-uploads",
"generate-pending-release-diffs": "bin/generate-pending-release-diffs.sh",
"format-js": "wp-scripts format",
"lint-js": "wp-scripts lint-js",
"format-php": "composer format",
Expand Down
Loading