From 3c083d7bff377069c8d1f5c7974a796f38446424 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Tue, 12 Apr 2022 10:19:10 -0600 Subject: [PATCH 1/4] add a pre and post release composer script --- composer.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index c85a114..f0f681d 100644 --- a/composer.json +++ b/composer.json @@ -40,9 +40,8 @@ ] }, "scripts": { - "bump:patch": "npm run bump:patch", - "bump:minor": "npm run bump:minor", - "bump:major": "npm run bump:major", + "release:pre": "bash scripts/pre-release", + "release:post": "bash scripts/post-release", "lint:php": "find ./pantheon-wordpress-edge-integrations.php ./inc ./tests -name '*.php' -exec php -l {} \\;", "lint:phpcs": "vendor/bin/phpcs -s --standard=phpcs.ruleset.xml .", "lint:phpcbf": "vendor/bin/phpcbf -s --standard=phpcs.ruleset.xml .", From 10b5930899bf36ce8b1974c2a36c26d9777d31b6 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Tue, 12 Apr 2022 10:19:24 -0600 Subject: [PATCH 2/4] add the pre and post release scripts --- scripts/post-release | 28 ++++++++++++++++++++++++++++ scripts/pre-release | 24 ++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 scripts/post-release create mode 100644 scripts/pre-release diff --git a/scripts/post-release b/scripts/post-release new file mode 100644 index 0000000..82e8ebd --- /dev/null +++ b/scripts/post-release @@ -0,0 +1,28 @@ +#!/bin/bash +# Announce the script so we know we're in the right place. +echo "Welcome to the post-release script! +In this script, we will bump the version number in the plugin file, package.json and the stable version readme." + +echo "Enter the current stable release version: " +read CURRENT_VERSION + +echo "Enter the next release version: " +read NEXT_VERSION + +# Check out the main branch and pull the latest changes. +git checkout main && git pull + +# Bump the version in the plugin file. +sed -i '' "s/Version: .*-dev/Version: $NEXT_VERSION-dev/" pantheon-wordpress-edge-integrations.php + +# Bump the version in the readme to the current stable. +sed -i '' "s/Stable tag: .*/Stable tag: $CURRENT_VERSION /" README.md + +# Bump the versions in the package.json and package-lock.json files. +node_modules/.bin/bump $NEXT_VERSION package.json package-lock.json + +# Commit the changes but don't push. +git add pantheon-wordpress-edge-integrations.php README.md package.json package-lock.json +git commit -m "Bump versions to $NEXT_VERSION and current stable $CURRENT_VERSION" + +echo "Bumped versions to $NEXT_VERSION and current stable $CURRENT_VERSION. Make sure to push to the main branch." \ No newline at end of file diff --git a/scripts/pre-release b/scripts/pre-release new file mode 100644 index 0000000..cf4949d --- /dev/null +++ b/scripts/pre-release @@ -0,0 +1,24 @@ +#!/bin/bash +# Announce the script so we know we're in the right place. +echo "Welcome to the release prep script!" + +# Get the release version. +echo "Enter the release version: " +read VERSION + +# Make sure we're on the latest version of the working tree and checkout a new release branch. +git checkout main && git pull +git checkout -b release-$VERSION + +# Drop the -dev in the plugin file. +sed -i '' "s/Version: .*-dev/Version: $VERSION/" pantheon-wordpress-edge-integrations.php + +# Bump the version in the readme. +sed -i '' "s/Stable tag: .*/Stable tag: $VERSION /" README.md + +# Commit the changes. +git add pantheon-wordpress-edge-integrations.php README.md +git commit -m "Bump version to $VERSION" +git push --set-upstream origin release-$VERSION + +echo "Created new release branch for $VERSION. Make sure to set the parent branch to 'build'." \ No newline at end of file From 4c7fd56d8f6c5ed3e3da78e61ce8c866888e8061 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Tue, 12 Apr 2022 10:23:59 -0600 Subject: [PATCH 3/4] update contributing.md with automated release process --- CONTRIBUTING.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 36dbb9c..385ddf9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -33,6 +33,20 @@ Combinations of these tools can be built into the `RoboFile.php`, e.g. spinning ## Release Process +### Automated +1. Merge all production-ready code into `main`. +2. Run `composer release:pre`. This will prompt for the release number, bump all the versions to that version, and push a new `release-major.minor.patch` version branch. +3. Create a PR against the `build` branch. +4. After all tests and code reviews pass (including resolving any merge conflicts) and automation makes the commit containing the build files, merge the PR into `build`. +5. Navigate to the [Releases](https://github.com/pantheon-systems/pantheon-wordpress-edge-integrations/releases) page and click the "Draft a New Release" button. +7. Under "Choose a Tag", enter the release version (`major.minor.patch`) and select "Create a new tag: `major.minor.patch` on publish". +8. Set the target branch to `build`. +9. Enter the version number as the release title. +10. Click the "Auto-generate release notes" button to add the changelog to the release. +11. Publish the release! +12. Run `composer release:post`. This will prompt for the current stable release and the next version number and bump the readme to the current stable, and all other versions to the next version. This is intended to be pushed to `main` after the release is published. + +### Manual 1. Merge all production-ready code into `main`. 2. On your local machine, checkout `main` and pull the latest. 3. Checkout a new release branch: `git checkout -b release-major.minor.patch` and bump the version number in [pantheon-wordpress-edge-integrations.php](https://github.com/pantheon-systems/pantheon-wordpress-edge-integrations/blob/main/pantheon-wordpress-edge-integrations.php#L7), and [package.json](https://github.com/pantheon-systems/pantheon-wordpress-edge-integrations/blob/main/package.json#L3) From 9623662711ea5d9212a311ae7bbdceced1690095 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Tue, 12 Apr 2022 09:17:33 -0600 Subject: [PATCH 4/4] Revert "Version 0.2.18." This reverts commit 51b0cf7a383ab3fad03fef7c690b138563f05f7e. --- pantheon-wordpress-edge-integrations.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pantheon-wordpress-edge-integrations.php b/pantheon-wordpress-edge-integrations.php index 010e740..25316ac 100644 --- a/pantheon-wordpress-edge-integrations.php +++ b/pantheon-wordpress-edge-integrations.php @@ -4,7 +4,7 @@ * Description: WordPress plugin to support Pantheon Edge Integrations and personalization features. * Author: Pantheon * Author URI: https://pantheon.io - * Version: 0.2.18-dev + * Version: 0.2.17-dev * * @package Pantheon/EdgeIntegrations */