Skip to content

Commit 2923241

Browse files
committed
Release automation
1 parent a39887a commit 2923241

3 files changed

Lines changed: 278 additions & 95 deletions

File tree

.github/ISSUE_TEMPLATE/4-REGULAR_RELEASE_CHECKLIST.md

Lines changed: 20 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -89,61 +89,27 @@ assignees: ''
8989
composer require wp-cli/wp-cli:^2.1.0
9090
```
9191
92-
### Updating the Phar build
92+
### Updating the Phar build & Publishing GitHub Releases
9393
9494
- [ ] Create a PR from the `release-x-x-x` branch in `wp-cli/wp-cli-bundle` and merge it. This will trigger the `wp-cli-release.*` builds.
9595
96-
- [ ] Create a Git tag and push it. **Do not create a GitHub _release_ just yet**.
96+
- [ ] Push the Git tag `v2.x.0` to [`wp-cli/wp-cli`](https://github.com/wp-cli/wp-cli/).
9797
98-
- [ ] Create a stable [Phar build](https://github.com/wp-cli/builds/tree/gh-pages/phar):
98+
This automatically triggers the release workflow in `wp-cli/wp-cli` which:
99+
- Generates the contributor list and changelog.
100+
- Promotes the Phar and manifest in the `builds` repo to stable, generates checksums, and signs with GPG.
101+
- Pushes the updated stable build back to `wp-cli/builds`.
102+
- Creates draft releases with the changelog and all 7 attached assets on both [`wp-cli/wp-cli`](https://github.com/wp-cli/wp-cli/) and [`wp-cli/wp-cli-bundle`](https://github.com/wp-cli/wp-cli-bundle/).
99103
100-
```
101-
cd wp-cli/builds/phar
102-
cp wp-cli-release.phar wp-cli.phar
103-
cp wp-cli-release.manifest.json wp-cli.manifest.json
104-
md5 -q wp-cli.phar > wp-cli.phar.md5
105-
shasum -a 256 wp-cli.phar | cut -d ' ' -f 1 > wp-cli.phar.sha256
106-
shasum -a 512 wp-cli.phar | cut -d ' ' -f 1 > wp-cli.phar.sha512
107-
```
108-
109-
- [ ] Sign the release with GPG (see <https://github.com/wp-cli/wp-cli/issues/2121>):
110-
111-
```
112-
gpg --output wp-cli.phar.gpg --default-key releases@wp-cli.org --sign wp-cli.phar
113-
gpg --output wp-cli.phar.asc --default-key releases@wp-cli.org --detach-sig --armor wp-cli.phar
114-
```
104+
- [ ] Review and publish the draft releases:
105+
- Review draft on [`wp-cli/wp-cli`](https://github.com/wp-cli/wp-cli/releases) and publish.
106+
- Review draft on [`wp-cli/wp-cli-bundle`](https://github.com/wp-cli/wp-cli-bundle/releases) and publish.
115107
116-
Note: The GPG key for `releases@wp-cli.org` has to be shared amongst maintainers.
117-
118-
- [ ] Verify the signature with `gpg --verify wp-cli.phar.asc wp-cli.phar`
119-
120-
- [ ] Perform one last sanity check on the Phar by ensuring it displays its information
121-
122-
```
123-
php wp-cli.phar --info
124-
```
125-
126-
- [ ] Commit the Phar and its hashes to the `builds` repo
127-
128-
```
129-
git status
130-
git add .
131-
git commit -m "Update stable to v2.x.0"
132-
```
133-
134-
- [ ] Create actual releases on GitHub: Make sure to upload the previously generated Phar from the `builds` repo.
135-
136-
```
137-
cp wp-cli.phar wp-cli-2.x.0.phar
138-
cp wp-cli.phar.gpg wp-cli-2.x.0.phar.gpg
139-
cp wp-cli.phar.asc wp-cli-2.x.0.phar.asc
140-
cp wp-cli.phar.md5 wp-cli-2.x.0.phar.md5
141-
cp wp-cli.phar.sha512 wp-cli-2.x.0.phar.sha256
142-
cp wp-cli.phar.sha512 wp-cli-2.x.0.phar.sha512
143-
cp wp-cli.manifest.json wp-cli-2.x.0.manifest.json
144-
```
145-
146-
Do this for both [`wp-cli/wp-cli`](https://github.com/wp-cli/wp-cli/) and [`wp-cli/wp-cli-bundle`](https://github.com/wp-cli/wp-cli-bundle/)
108+
Publishing the release on `wp-cli/wp-cli` automatically triggers post-release automation workflows which:
109+
- Bump the version to the next alpha in [`wp-cli/wp-cli`](https://github.com/wp-cli/wp-cli) (`VERSION` file and `composer.json` branch alias).
110+
- Reset the framework dependency in [`wp-cli/wp-cli-bundle`](https://github.com/wp-cli/wp-cli-bundle) back to `"dev-main"`.
111+
- Close the shipped milestones across all bundled repositories.
112+
- Trigger handbook docs regeneration and website repository dispatch.
147113
148114
- [ ] Verify Phar release artifact
149115
@@ -160,52 +126,11 @@ assignees: ''
160126
<PHP serialized string with version numbers>
161127
```
162128
163-
### Verify the Debian and RPM builds
164-
165-
- [ ] In the [`wp-cli/builds`](https://github.com/wp-cli/builds) repository, verify that the Debian and RPM builds exist
129+
### Post-Release Manual Tasks
166130
167-
**Note:** Right now, they are actually already generated automatically before all the tagging happened.
131+
- [ ] Update Homebrew formula (if not automated via action):
132+
Follow this [example PR](https://github.com/Homebrew/homebrew-core/pull/152339) to update version numbers and sha256 for both `wp-cli` and `wp-cli-completion`.
168133
169-
- [ ] Change symlink of `deb/php-wpcli_latest_all.deb` to point to the new stable version.
170-
171-
### Updating the Homebrew formula (should happen automatically)
172-
173-
- [ ] Follow this [example PR](https://github.com/Homebrew/homebrew-core/pull/152339) to update version numbers and sha256 for both `wp-cli` and `wp-cli-completion`
174-
175-
### Updating the website
176-
177-
- [ ] Verify <https://github.com/wp-cli/wp-cli.github.com#readme> is up-to-date
178-
179-
- [ ] Update all version references on the homepage (and localized homepages).
180-
181-
Can be mostly done by using search and replace for the version number and the blog post URL.
182-
183-
- [ ] Update the [roadmap](https://make.wordpress.org/cli/handbook/roadmap/) to mention the current stable version
184-
185-
- [ ] Tag a release of the website
186-
187-
### Announcing
188-
189-
- [ ] Publish the blog post
190-
191-
- [ ] Announce release on the [WP-CLI Twitter account](https://twitter.com/wpcli)
192-
193-
- [ ] Optional: Announce using the `/announce` slash command in the [`#cli`](https://wordpress.slack.com/messages/C02RP4T41) Slack room.
194-
195-
This pings a lot of people, so it's not always desired. Plus, the blog post will pop up on Slack anyway.
196-
197-
### Bumping WP-CLI version again
198-
199-
- [ ] Bump [VERSION](https://github.com/wp-cli/wp-cli/blob/master/VERSION) in [`wp-cli/wp-cli`](https://github.com/wp-cli/wp-cli) again.
200-
201-
For instance, if the release version was `2.8.0`, the version should be bumped to `2.9.0-alpha`.
202-
203-
Doing so ensures `wp cli update --nightly` works as expected.
204-
205-
- [ ] Change the version constraint on `"wp-cli/wp-cli"` in `wp-cli/wp-cli-bundle`'s [`composer.json`](https://github.com/wp-cli/wp-cli-bundle/blob/master/composer.json) file back to `"dev-main"`.
206-
207-
```
208-
composer require wp-cli/wp-cli:dev-main
209-
```
134+
- [ ] Publish the release blog post on the [make.wordpress.org CLI blog](https://make.wordpress.org/cli/).
210135
211-
- [ ] Adapt the branch alias in `wp-cli/wp-cli`'s [`composer.json`](https://github.com/wp-cli/wp-cli/blob/master/composer.json) file to match the new alpha version.
136+
- [ ] Announce release on Twitter / Slack.

.github/workflows/post-release.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: Post-Release Automation
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
tag:
9+
description: 'Published release tag (e.g. v2.13.0)'
10+
required: true
11+
12+
permissions:
13+
contents: write
14+
15+
jobs:
16+
post-release:
17+
name: Post-Release Version Bumps & Cleanup
18+
runs-on: ubuntu-latest
19+
if: ${{ github.repository_owner == 'wp-cli' }}
20+
21+
steps:
22+
- name: Calculate next alpha and branch alias versions
23+
id: vars
24+
run: |
25+
TAG="${{ github.event.inputs.tag || github.event.release.tag_name }}"
26+
VERSION="${TAG#v}"
27+
28+
# Extract Major.Minor.Patch
29+
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
30+
NEXT_MINOR=$((MINOR + 1))
31+
NEXT_ALPHA="${MAJOR}.${NEXT_MINOR}.0-alpha"
32+
NEXT_ALIAS="${MAJOR}.${NEXT_MINOR}.x-dev"
33+
34+
echo "tag=$TAG" >> $GITHUB_OUTPUT
35+
echo "version=$VERSION" >> $GITHUB_OUTPUT
36+
echo "next_alpha=$NEXT_ALPHA" >> $GITHUB_OUTPUT
37+
echo "next_alias=$NEXT_ALIAS" >> $GITHUB_OUTPUT
38+
39+
- name: Set up PHP and Composer
40+
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
41+
with:
42+
php-version: 'latest'
43+
tools: composer
44+
env:
45+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
47+
- name: Check out wp-cli/wp-cli
48+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
49+
with:
50+
ref: main
51+
path: wp-cli
52+
53+
- name: Bump alpha version and branch-alias in wp-cli/wp-cli
54+
run: |
55+
cd wp-cli
56+
echo "${{ steps.vars.outputs.next_alpha }}" > VERSION
57+
composer config extra.branch-alias.dev-main "${{ steps.vars.outputs.next_alias }}"
58+
59+
git config user.name "GitHub Action"
60+
git config user.email "action@github.com"
61+
git add VERSION composer.json
62+
git commit -m "Bump version to ${{ steps.vars.outputs.next_alpha }}"
63+
git push origin main
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
67+
- name: Check out wp-cli/wp-cli-bundle
68+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
69+
with:
70+
repository: wp-cli/wp-cli-bundle
71+
ref: main
72+
token: ${{ secrets.ACTIONS_BOT }}
73+
path: wp-cli-bundle
74+
75+
- name: Reset framework constraint and branch-alias in wp-cli/wp-cli-bundle
76+
run: |
77+
cd wp-cli-bundle
78+
composer require "wp-cli/wp-cli:dev-main" --no-update --no-interaction
79+
composer config extra.branch-alias.dev-main "${{ steps.vars.outputs.next_alias }}"
80+
81+
git config user.name "GitHub Action"
82+
git config user.email "action@github.com"
83+
git add composer.json
84+
git commit -m "Reset wp-cli framework dependency to dev-main and bump branch alias"
85+
git push origin main
86+
87+
- name: Check out wp-cli/wp-cli-dev for maintenance tools
88+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
89+
with:
90+
repository: wp-cli/wp-cli-dev
91+
path: wp-cli-dev
92+
93+
- name: Close released milestones across bundle repos
94+
env:
95+
GITHUB_TOKEN: ${{ secrets.ACTIONS_BOT }}
96+
run: |
97+
cd wp-cli-dev
98+
composer install --no-interaction
99+
vendor/bin/wp maintenance close-released --bundle
100+
101+
- name: Dispatch release notification to website repository
102+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
103+
with:
104+
github-token: ${{ secrets.ACTIONS_BOT }}
105+
script: |
106+
await github.rest.repos.createDispatchEvent({
107+
owner: 'wp-cli',
108+
repo: 'wp-cli.github.com',
109+
event_type: 'release-published',
110+
client_payload: {
111+
tag: '${{ steps.vars.outputs.tag }}',
112+
version: '${{ steps.vars.outputs.version }}'
113+
}
114+
});

.github/workflows/release.yml

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+*'
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: 'Tag to release (e.g. v2.13.0)'
11+
required: true
12+
13+
permissions:
14+
contents: write
15+
16+
jobs:
17+
prepare-draft-release:
18+
name: Prepare Stable Build & Create Draft Releases
19+
runs-on: ubuntu-latest
20+
if: ${{ github.repository_owner == 'wp-cli' }}
21+
22+
steps:
23+
- name: Determine version
24+
id: vars
25+
run: |
26+
TAG="${{ github.event.inputs.tag || github.ref_name }}"
27+
VERSION="${TAG#v}"
28+
echo "tag=$TAG" >> $GITHUB_OUTPUT
29+
echo "version=$VERSION" >> $GITHUB_OUTPUT
30+
31+
- name: Check out wp-cli/builds repository
32+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
33+
with:
34+
repository: wp-cli/builds
35+
ref: gh-pages
36+
token: ${{ secrets.ACTIONS_BOT }}
37+
path: builds
38+
39+
- name: Check out wp-cli/wp-cli-dev repository
40+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
41+
with:
42+
repository: wp-cli/wp-cli-dev
43+
path: wp-cli-dev
44+
45+
- name: Set up PHP and Composer
46+
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
47+
with:
48+
php-version: 'latest'
49+
tools: composer
50+
env:
51+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
53+
- name: Install dependencies for maintenance tools
54+
run: |
55+
cd wp-cli-dev
56+
composer install --no-interaction
57+
58+
- name: Generate Changelog and Contributor List
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.ACTIONS_BOT || secrets.GITHUB_TOKEN }}
61+
run: |
62+
mkdir -p release-assets
63+
cd wp-cli-dev
64+
65+
echo "## Contributors" > ../release-assets/release_notes.md
66+
echo "" >> ../release-assets/release_notes.md
67+
vendor/bin/wp maintenance contrib-list --format=markdown >> ../release-assets/release_notes.md
68+
echo "" >> ../release-assets/release_notes.md
69+
echo "## Changelog" >> ../release-assets/release_notes.md
70+
echo "" >> ../release-assets/release_notes.md
71+
vendor/bin/wp maintenance release-notes >> ../release-assets/release_notes.md
72+
73+
- name: Import GPG key
74+
uses: crazy-max/ghaction-import-gpg@cb9bde2e2525e6865904e392450c3401a753db76 # v6.2.0
75+
with:
76+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
77+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
78+
79+
- name: Promote release Phar to stable & generate signatures
80+
run: |
81+
VERSION="${{ steps.vars.outputs.version }}"
82+
83+
cd builds/phar
84+
85+
# Promote release files to stable
86+
cp wp-cli-release.phar wp-cli.phar
87+
cp wp-cli-release.manifest.json wp-cli.manifest.json
88+
89+
# Generate stable hashes
90+
md5sum wp-cli.phar | cut -d ' ' -f 1 > wp-cli.phar.md5
91+
sha256sum wp-cli.phar | cut -d ' ' -f 1 > wp-cli.phar.sha256
92+
sha512sum wp-cli.phar | cut -d ' ' -f 1 > wp-cli.phar.sha512
93+
94+
# Sign stable Phar with GPG
95+
gpg --batch --yes --output wp-cli.phar.gpg --default-key releases@wp-cli.org --sign wp-cli.phar
96+
gpg --batch --yes --output wp-cli.phar.asc --default-key releases@wp-cli.org --detach-sig --armor wp-cli.phar
97+
98+
# Prepare versioned files for GitHub release upload
99+
cp wp-cli.phar "../../release-assets/wp-cli-${VERSION}.phar"
100+
cp wp-cli.phar.gpg "../../release-assets/wp-cli-${VERSION}.phar.gpg"
101+
cp wp-cli.phar.asc "../../release-assets/wp-cli-${VERSION}.phar.asc"
102+
cp wp-cli.phar.md5 "../../release-assets/wp-cli-${VERSION}.phar.md5"
103+
cp wp-cli.phar.sha256 "../../release-assets/wp-cli-${VERSION}.phar.sha256"
104+
cp wp-cli.phar.sha512 "../../release-assets/wp-cli-${VERSION}.phar.sha512"
105+
cp wp-cli.manifest.json "../../release-assets/wp-cli-${VERSION}.manifest.json"
106+
107+
- name: Commit & push updated stable build to wp-cli/builds
108+
run: |
109+
VERSION="${{ steps.vars.outputs.version }}"
110+
111+
cd builds
112+
git config user.name "GitHub Action"
113+
git config user.email "action@github.com"
114+
git add phar/wp-cli.phar phar/wp-cli.phar.* phar/wp-cli.manifest.json
115+
git commit -m "Update stable to v${VERSION}"
116+
git push origin gh-pages
117+
118+
- name: Create Draft Release on wp-cli/wp-cli
119+
env:
120+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121+
run: |
122+
TAG="${{ steps.vars.outputs.tag }}"
123+
VERSION="${{ steps.vars.outputs.version }}"
124+
125+
gh release create "$TAG" \
126+
--repo wp-cli/wp-cli \
127+
--draft \
128+
--title "Version $VERSION" \
129+
--notes-file release-assets/release_notes.md \
130+
release-assets/wp-cli-*
131+
132+
- name: Create Draft Release on wp-cli/wp-cli-bundle
133+
env:
134+
GH_TOKEN: ${{ secrets.ACTIONS_BOT }}
135+
run: |
136+
TAG="${{ steps.vars.outputs.tag }}"
137+
VERSION="${{ steps.vars.outputs.version }}"
138+
139+
gh release create "$TAG" \
140+
--repo wp-cli/wp-cli-bundle \
141+
--draft \
142+
--title "Version $VERSION" \
143+
--notes-file release-assets/release_notes.md \
144+
release-assets/wp-cli-*

0 commit comments

Comments
 (0)