Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

Add automation to the release process #97

Merged
merged 5 commits into from
Apr 13, 2022
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
14 changes: 14 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 .",
Expand Down
28 changes: 28 additions & 0 deletions scripts/post-release
Original file line number Diff line number Diff line change
@@ -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."
24 changes: 24 additions & 0 deletions scripts/pre-release
Original file line number Diff line number Diff line change
@@ -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'."