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
67 changes: 67 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Release
on:
push:
branches:
- trunk

permissions:
contents: write

jobs:
check_and_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up NodeJS
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: npm

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
tools: composer
php-version: '8.1'

- name: Build the plugin
run: |
npm ci

- name: Check for version change
id: version_check
run: |
OLD_VERSION=$(git show HEAD^:vip-governance.php | sed -n 's/.*Version: *//p' | tr -d '[:space:]')
NEW_VERSION=$(git show HEAD:vip-governance.php | sed -n 's/.*Version: *//p' | tr -d '[:space:]')
DEFINED_VERSION=$(git show HEAD:vip-governance.php | sed -n "s/.*define( 'WPCOMVIP__GOVERNANCE__PLUGIN_VERSION', '\\([^']*\\)'.*/\\1/p")

if [ "$NEW_VERSION" != "$DEFINED_VERSION" ]; then
echo "Error: Version mismatch detected!"
echo "Plugin header version: $NEW_VERSION"
echo "Defined constant version: $DEFINED_VERSION"
exit 1
fi

if [ "$OLD_VERSION" != "$NEW_VERSION" ]; then
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "Version changed from $OLD_VERSION to $NEW_VERSION"
else
echo "No version change detected"
fi

- name: Build plugin zip
if: steps.version_check.outputs.new_version
run: |
VERSION="${{ steps.version_check.outputs.new_version }}"
git archive --prefix "vip-governance/" HEAD -o "vip-governance-${VERSION}.zip"

- name: Create Release
if: steps.version_check.outputs.new_version
uses: softprops/action-gh-release@v2'd
with:
tag_name: ${{ steps.version_check.outputs.new_version }}
files: vip-governance-${{ steps.version_check.outputs.new_version }}.zip
generate_release_notes: true
66 changes: 12 additions & 54 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,22 @@
# Release steps

## 1. Create a release branch

1. Before merging a feature, create a release branch for the next target version, e.g.

```bash
git checkout trunk
git checkout -b planned-release/0.2.1
```

2. In GitHub, select the base branch as the `planned-release/...` branch.
3. Merge feature branches into the `planned-release/...` branch.

## 2. Update build files

```bash
npm run build
composer install --no-dev
```

Note: If new production dependencies have been added, modify the root `.gitignore` file to include new `vendor/` subfolders.

Now commit these build changes in.

## 3. Bump plugin version

1. When the version is ready for release, inside the `planned-release/...` branch, bump the version number in `vip-governance.php`. Change plugin header and `WPCOMVIP__GOVERNANCE__PLUGIN_VERSION` to match new version.
2. In `package.json`, also bump the `version` field to match, and run `npm install` to update `package-lock.json`.
3. Commit the changed files to the `planned-release/...` branch.
4. Create a PR for the planned release branch (e.g. "Planned release 0.2.1") and merge to `trunk`.

## 4. Tag branch for release

1. In `trunk`, add a signed tag for the release:
# Release steps

```bash
git checkout trunk
git pull
git tag -s -a <version> -m "Release <version>"
## 1. Bump plugin version

# e.g. git tag -s -a 1.0.2 -m "Release 1.0.2"
```
1. When the version is ready for release, bump the version number in `vip-governance.php` and `package.json`. Change plugin header and `WPCOMVIP__GOVERNANCE__PLUGIN_VERSION` to match new version.
2. PR version changes (e.g. "Release 1.2.3") and merge to `trunk`. When a version change is detected, the `release` workflow will generate a new tag and release ZIP.

2. Run `git push --tags`.
## 2. Update integrations

## 5. Create a release
Patch updates (e.g. `1.2.3` -> `1.2.4`) do not require any additional steps.

1. In the `vip-governance` folder, run this command to create a plugin ZIP:
This section applies if the plugin has increased by a minor (e.g. `1.2` -> `1.3`) or major (e.g. `1.2` -> `2.0`) version.

```bash
git archive --prefix "vip-governance/" <version> -o vip-governance-<version>.zip
For an example updating an integration version, [see this mu-plugins PR](https://github.com/Automattic/vip-go-mu-plugins/pull/5409).

# e.g. git archive --prefix "vip-governance/" 1.0.2 -o vip-governance-1.0.2.zip
#
# Creates a ZIP archive with the prefix folder "vip-governance/" containing files from tag 1.0.2
```
1. Ensure that the latest release of the VIP Governance plugin has been [pulled in `vip-go-mu-plugins-ext`](https://github.com/Automattic/vip-go-mu-plugins-ext/tree/trunk/vip-integrations). Updates are synced by minor version, so a patch update of `1.2.3` will be pulled into `vip-integrations/vip-governance-1.2`. If it's not, wait for the [**Update versioned external dependencies** workflow](https://github.com/Automattic/vip-go-mu-plugins-ext/actions/workflows/update-deps.yml) to pull in the latest changes, or run it manually.

2. Visit the [vip-governance create release page](https://github.com/automattic/vip-governance-plugin/releases/new).
3. Select the newly created version tag in the dropdown.
4. For the title, enter the release version name (e.g. `1.0.2`)
5. Add a description of release changes.
6. Attach the plugin ZIP.
7. Click "Publish release."
2. Create a branch on [vip-go-mu-plugins](https://github.com/Automattic/vip-go-mu-plugins).
3. Update the `integrations/vip-governance.php` version to match the minor version of the plugin, e.g. `1.2`. This will correspond with the folder path for the plugin [in `vip-go-mu-plugins-ext`](https://github.com/Automattic/vip-go-mu-plugins-ext/tree/trunk/vip-integrations).
4. Submit the PR, get it approved, and merge.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@
"lint:phpcs": "vendor/bin/phpcs --cache",
"lint:phpcs:fix": "vendor/bin/phpcbf",
"packages-update": "wp-scripts packages-update",
"plugin-zip": "npm run build && composer install --prefer-dist --optimize-autoloader --no-dev && wp-scripts plugin-zip",
"prepare": "npx simple-git-hooks",
"postinstall": "composer install",
"postinstall": "composer install --no-dev",
"test": "npm run test:unit",
"test:unit": "npm run test:php && npm run test:js",
"test:e2e": "npx playwright test",
Expand Down
4 changes: 2 additions & 2 deletions vip-governance.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: Add additional governance capabilities to the block editor.
* Author: WordPress VIP
* Text Domain: vip-governance
* Version: 1.0.15
* Version: 1.0.16
* Requires at least: 6.0
* Tested up to: 6.9
* Requires PHP: 8.1
Expand Down Expand Up @@ -33,7 +33,7 @@
return;
}

define( 'WPCOMVIP__GOVERNANCE__PLUGIN_VERSION', '1.0.15' );
define( 'WPCOMVIP__GOVERNANCE__PLUGIN_VERSION', '1.0.16' );
define( 'WPCOMVIP__GOVERNANCE__RULES_SCHEMA_VERSION', '1.0.0' );

if ( ! defined( 'WPCOMVIP_GOVERNANCE_ROOT_PLUGIN_FILE' ) ) {
Expand Down