Skip to content

Commit 94a7b98

Browse files
iangmaiaCopilotAliSoftware
authored
[Tooling] Add Buildkite release pipelines and fastlane lanes for ReleasesV2 (#2583)
* Add lanes for CI release automation * Update helper scripts * Add release pipelines * Add build/distribute release pipeline * Update main pipeline * Improve localization automation * Update localization documentation * Update release process documentation * Add backmerge PR after .po strings bundle generation * Add `skip ci` to release process commits * Delete release branch once published * Add a reviewer to backmerge PRs * Tag instead of create prerelease * Add buildkite annotation to backmerge prs * Fix Rubocop violations * Use `PROJECT_ROOT_FOLDER` to run external commands * Fix parameter name * Create a PR when downloading translations * Forward GITHUB_USERNAME to the lanes * Add IMAGE_ID to release pipeline * Adjust paths after monorepo merge * Adjust paths in Fastlane * Fix monorepo path * Add Studio links to build in the GitHub release * Create release notes draft * Use RELEASE_VERSION also for build distribution * Simplify new beta lane * Use `current_git_branch` * Fix error when downloading files mkdirSync with { recursive: true } creates all missing parent directories and is a no-op if they already exist — so the try/catch for EEXIST is no longer needed * Improve log / confirmation message * Add IMAGE_ID * Let the version in `distribute_release_build` to be read from package.json * Update release-process.md documentation * Use `git checkout -B "$BRANCH_NAME" "origin/$BRANCH_NAME"` instead of checkout + pull * Add RELEASE-NOTES.txt validation * Improve extract_release_notes regex * Consolidate version bump, commit and push * Update release-process.md section about running lanes locally * Update fastlane/Fastfile code_freeze comment Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Exclude beta tags from find_previous_tag * Add version mismatch guard in new_beta_release * Use absolute path constant for .pot file * Add changes to replicate find_previous_tag * Create beta tags and GitHub releases only after the release is built * Add validation to version parameter Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Use latest release-toolkit to use the new `find_previous_tag` * Update docs/release-process.md Co-authored-by: Olivier Halligon <olivier.halligon@automattic.com> * Update download_translations lane to download translations directly from GlotPress --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Olivier Halligon <olivier.halligon@automattic.com>
1 parent c86ecea commit 94a7b98

21 files changed

+962
-279
lines changed

.buildkite/commands/build-for-windows.ps1

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ if ($BuildType -eq $BUILD_TYPE_DEV) {
4646
$env:IS_DEV_BUILD="true"
4747
} else {
4848
Write-Host "Preparing release build..."
49-
node ./scripts/confirm-tag-matches-version.mjs
50-
If ($LastExitCode -ne 0) { Exit $LastExitCode }
5149
}
5250

5351
# Set architecture environment variable for AppX packaging
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash -eu
2+
3+
# Script to checkout a specific release branch.
4+
# Usage: ./checkout-release-branch.sh <RELEASE_VERSION>
5+
#
6+
# Buildkite, by default, checks out a specific commit, ending up in a detached HEAD state.
7+
# But in some cases, we need to ensure to be checked out on the `release/*` branch instead, namely:
8+
# - When a `release-pipelines/*.yml` will end up needing to do a `git push` to the `release/*` branch (for version bumps)
9+
# - When doing a new build from a job that was `pipeline upload`'d by such a pipeline,
10+
# to ensure that the job doing the build would include that recent extra commit before starting the build.
11+
12+
echo "--- :git: Checkout Release Branch"
13+
14+
if [[ -n "${1:-}" ]]; then
15+
RELEASE_VERSION="$1"
16+
elif [[ "${BUILDKITE_BRANCH:-}" =~ ^release/ ]]; then
17+
RELEASE_VERSION="${BUILDKITE_BRANCH#release/}"
18+
else
19+
echo "Error: RELEASE_VERSION parameter missing and BUILDKITE_BRANCH is not a release branch"
20+
exit 1
21+
fi
22+
BRANCH_NAME="release/${RELEASE_VERSION}"
23+
24+
git fetch origin "$BRANCH_NAME"
25+
git checkout -B "$BRANCH_NAME" "origin/$BRANCH_NAME"

.buildkite/pipeline.yml

Lines changed: 0 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -181,98 +181,3 @@ steps:
181181
notify:
182182
- github_commit_status:
183183
context: Distribute Dev Builds
184-
185-
- group: 📦 Build for Mac
186-
key: release-mac
187-
steps:
188-
- label: 🔨 Mac Release Build - {{matrix}}
189-
agents:
190-
queue: mac
191-
command: |
192-
.buildkite/commands/prepare-environment.sh
193-
194-
.buildkite/commands/install-node-dependencies.sh
195-
node ./scripts/confirm-tag-matches-version.mjs
196-
197-
echo "--- :node: Building Binary"
198-
npm run make:macos-{{matrix}}
199-
200-
# Local trial and error show this needs to run before the DMG generation (obviously) but after the binary has been built
201-
echo "--- :hammer: Rebuild fs-attr if necessary before generating DMG"
202-
case {{matrix}} in
203-
x64)
204-
echo "Rebuilding fs-xattr for {{matrix}} architecture"
205-
npm rebuild fs-xattr --cpu universal
206-
;;
207-
arm64)
208-
echo "No need to rebuild fs-xattr because it works out of the box on Apple Silicon"
209-
;;
210-
*)
211-
echo "^^^ +++ Unexpected architecture {{matrix}}"
212-
exit 1
213-
;;
214-
esac
215-
216-
echo "--- :node: Packaging in DMG"
217-
npm run make:dmg-{{matrix}}
218-
219-
echo "--- 📃 Notarizing Binary"
220-
bundle exec fastlane notarize_binary
221-
plugins: [$CI_TOOLKIT_PLUGIN, $NVM_PLUGIN]
222-
artifact_paths:
223-
- apps/studio/out/**/*.app.zip
224-
- apps/studio/out/*.dmg
225-
matrix:
226-
- x64
227-
- arm64
228-
notify:
229-
- github_commit_status:
230-
context: All Mac Release Builds
231-
if: build.tag =~ /^v[0-9]+/
232-
233-
- group: 📦 Build for Windows
234-
key: release-windows
235-
steps:
236-
- label: 🔨 Windows Release Build - {{matrix}}
237-
agents:
238-
queue: windows
239-
command: powershell -File .buildkite/commands/build-for-windows.ps1 -BuildType release -Architecture {{matrix}}
240-
artifact_paths:
241-
- apps\studio\out\**\studio-setup.exe
242-
- apps\studio\out\**\studio-update.nupkg
243-
- apps\studio\out\**\RELEASES
244-
- apps\studio\out\**\*.appx
245-
plugins: [$CI_TOOLKIT_PLUGIN, $NVM_PLUGIN]
246-
matrix:
247-
- x64
248-
- arm64
249-
notify:
250-
- github_commit_status:
251-
context: All Windows Release Builds
252-
if: build.tag =~ /^v[0-9]+/
253-
254-
- label: ":rocket: Publish Release Builds"
255-
command: |
256-
echo "--- :node: Downloading Binaries"
257-
buildkite-agent artifact download "*.zip" .
258-
buildkite-agent artifact download "*.dmg" .
259-
buildkite-agent artifact download "*.exe" .
260-
buildkite-agent artifact download "*.appx" .
261-
buildkite-agent artifact download "*.nupkg" .
262-
buildkite-agent artifact download "*\\RELEASES" .
263-
264-
.buildkite/commands/install-node-dependencies.sh
265-
266-
echo "--- :fastlane: Distributing Release Builds"
267-
install_gems
268-
bundle exec fastlane distribute_release_build
269-
agents:
270-
queue: mac
271-
depends_on:
272-
- step: release-mac
273-
- step: release-windows
274-
plugins: [$CI_TOOLKIT_PLUGIN, $NVM_PLUGIN]
275-
if: build.tag =~ /^v[0-9]+/
276-
notify:
277-
- github_commit_status:
278-
context: Publish Release Builds
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json
2+
#
3+
# Release build and distribution pipeline.
4+
#
5+
# Triggered as a separate Buildkite build by the fastlane lanes (code_freeze, new_beta_release,
6+
# finalize_release) via `buildkite_add_trigger_step` / `buildkite_trigger_build`.
7+
#
8+
# Expects `RELEASE_VERSION` env var to be set (e.g., '1.7.4').
9+
# Each step checks out the release branch to ensure it builds the latest commit.
10+
---
11+
12+
# Used by mac agents only
13+
env:
14+
IMAGE_ID: $IMAGE_ID
15+
16+
steps:
17+
- group: 📦 Build for Mac
18+
key: release-mac
19+
steps:
20+
- label: 🔨 Mac Release Build - {{matrix}}
21+
agents:
22+
queue: mac
23+
command: |
24+
.buildkite/commands/checkout-release-branch.sh "${RELEASE_VERSION}"
25+
26+
.buildkite/commands/prepare-environment.sh
27+
28+
.buildkite/commands/install-node-dependencies.sh
29+
30+
echo "--- :node: Building Binary"
31+
npm run make:macos-{{matrix}}
32+
33+
# Local trial and error show this needs to run before the DMG generation (obviously) but after the binary has been built
34+
echo "--- :hammer: Rebuild fs-attr if necessary before generating DMG"
35+
case {{matrix}} in
36+
x64)
37+
echo "Rebuilding fs-xattr for {{matrix}} architecture"
38+
npm rebuild fs-xattr --cpu universal
39+
;;
40+
arm64)
41+
echo "No need to rebuild fs-xattr because it works out of the box on Apple Silicon"
42+
;;
43+
*)
44+
echo "^^^ +++ Unexpected architecture {{matrix}}"
45+
exit 1
46+
;;
47+
esac
48+
49+
echo "--- :node: Packaging in DMG"
50+
npm run make:dmg-{{matrix}}
51+
52+
echo "--- 📃 Notarizing Binary"
53+
bundle exec fastlane notarize_binary
54+
plugins: [$CI_TOOLKIT_PLUGIN, $NVM_PLUGIN]
55+
artifact_paths:
56+
- apps/studio/out/**/*.app.zip
57+
- apps/studio/out/*.dmg
58+
matrix:
59+
- x64
60+
- arm64
61+
notify:
62+
- github_commit_status:
63+
context: All Mac Release Builds
64+
65+
- group: 📦 Build for Windows
66+
key: release-windows
67+
steps:
68+
- label: 🔨 Windows Release Build - {{matrix}}
69+
agents:
70+
queue: windows
71+
command: |
72+
bash .buildkite/commands/checkout-release-branch.sh "${RELEASE_VERSION}"
73+
powershell -File .buildkite/commands/build-for-windows.ps1 -BuildType release -Architecture {{matrix}}
74+
artifact_paths:
75+
- apps\studio\out\**\studio-setup.exe
76+
- apps\studio\out\**\studio-update.nupkg
77+
- apps\studio\out\**\RELEASES
78+
- apps\studio\out\**\*.appx
79+
plugins: [$CI_TOOLKIT_PLUGIN, $NVM_PLUGIN]
80+
matrix:
81+
- x64
82+
- arm64
83+
notify:
84+
- github_commit_status:
85+
context: All Windows Release Builds
86+
87+
- label: ":rocket: Publish Release Builds"
88+
command: |
89+
echo "--- :robot_face: Use bot for Git operations"
90+
source use-bot-for-git
91+
92+
.buildkite/commands/checkout-release-branch.sh "${RELEASE_VERSION}"
93+
94+
echo "--- :node: Downloading Binaries"
95+
buildkite-agent artifact download "*.zip" .
96+
buildkite-agent artifact download "*.dmg" .
97+
buildkite-agent artifact download "*.exe" .
98+
buildkite-agent artifact download "*.appx" .
99+
buildkite-agent artifact download "*.nupkg" .
100+
buildkite-agent artifact download "*\\RELEASES" .
101+
102+
.buildkite/commands/install-node-dependencies.sh
103+
104+
echo "--- :fastlane: Distributing Release Builds"
105+
install_gems
106+
bundle exec fastlane distribute_release_build
107+
agents:
108+
queue: mac
109+
depends_on:
110+
- step: release-mac
111+
- step: release-windows
112+
plugins: [$CI_TOOLKIT_PLUGIN, $NVM_PLUGIN]
113+
notify:
114+
- github_commit_status:
115+
context: Publish Release Builds
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json
2+
---
3+
4+
env:
5+
IMAGE_ID: $IMAGE_ID
6+
7+
steps:
8+
- label: ":snowflake: Code Freeze"
9+
plugins: [$CI_TOOLKIT_PLUGIN, $NVM_PLUGIN]
10+
command: |
11+
echo "--- :robot_face: Use bot for Git operations"
12+
source use-bot-for-git
13+
14+
echo "--- :npm: Install Node dependencies"
15+
.buildkite/commands/install-node-dependencies.sh
16+
17+
echo "--- :ruby: Setup Ruby Tools"
18+
install_gems
19+
20+
echo "--- :snowflake: Execute Code Freeze"
21+
bundle exec fastlane code_freeze version:"${RELEASE_VERSION}" github_username:"${GITHUB_USERNAME}" skip_confirm:true
22+
artifact_paths:
23+
- i18n/bundle-strings.pot
24+
agents:
25+
queue: mac
26+
retry:
27+
manual:
28+
reason: If release jobs fail, you should always re-trigger the task from Releases V2 rather than retrying the individual job from Buildkite
29+
allowed: false
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json
2+
---
3+
4+
env:
5+
IMAGE_ID: $IMAGE_ID
6+
7+
steps:
8+
- label: ":earth_asia: Download Translations"
9+
plugins: [$CI_TOOLKIT_PLUGIN, $NVM_PLUGIN]
10+
command: |
11+
echo "--- :robot_face: Use bot for Git operations"
12+
source use-bot-for-git
13+
14+
.buildkite/commands/checkout-release-branch.sh "${RELEASE_VERSION}"
15+
16+
echo "--- :ruby: Setup Ruby Tools"
17+
install_gems
18+
19+
echo "--- :earth_asia: Download Translations"
20+
bundle exec fastlane download_translations github_username:"${GITHUB_USERNAME}" skip_confirm:true
21+
agents:
22+
queue: mac
23+
retry:
24+
manual:
25+
reason: If release jobs fail, you should always re-trigger the task from Releases V2 rather than retrying the individual job from Buildkite
26+
allowed: false
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json
2+
---
3+
4+
env:
5+
IMAGE_ID: $IMAGE_ID
6+
7+
steps:
8+
- label: ":checkered_flag: Finalize Release"
9+
plugins: [$CI_TOOLKIT_PLUGIN, $NVM_PLUGIN]
10+
command: |
11+
echo "--- :robot_face: Use bot for Git operations"
12+
source use-bot-for-git
13+
14+
.buildkite/commands/checkout-release-branch.sh "${RELEASE_VERSION}"
15+
16+
echo "--- :ruby: Setup Ruby Tools"
17+
install_gems
18+
19+
echo "--- :checkered_flag: Finalize Release"
20+
bundle exec fastlane finalize_release version:"${RELEASE_VERSION}" skip_confirm:true
21+
agents:
22+
queue: mac
23+
retry:
24+
manual:
25+
reason: If release jobs fail, you should always re-trigger the task from Releases V2 rather than retrying the individual job from Buildkite
26+
allowed: false
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json
2+
---
3+
4+
env:
5+
IMAGE_ID: $IMAGE_ID
6+
7+
steps:
8+
- label: ":package: New Beta Release"
9+
plugins: [$CI_TOOLKIT_PLUGIN, $NVM_PLUGIN]
10+
command: |
11+
echo "--- :robot_face: Use bot for Git operations"
12+
source use-bot-for-git
13+
14+
.buildkite/commands/checkout-release-branch.sh "${RELEASE_VERSION}"
15+
16+
echo "--- :ruby: Setup Ruby Tools"
17+
install_gems
18+
19+
echo "--- :package: Create New Beta"
20+
bundle exec fastlane new_beta_release version:"${RELEASE_VERSION}" skip_confirm:true
21+
agents:
22+
queue: mac
23+
retry:
24+
manual:
25+
reason: If release jobs fail, you should always re-trigger the task from Releases V2 rather than retrying the individual job from Buildkite
26+
allowed: false
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json
2+
---
3+
4+
env:
5+
IMAGE_ID: $IMAGE_ID
6+
7+
steps:
8+
- label: ":fire: New Hotfix Release"
9+
plugins: [$CI_TOOLKIT_PLUGIN, $NVM_PLUGIN]
10+
command: |
11+
echo "--- :robot_face: Use bot for Git operations"
12+
source use-bot-for-git
13+
14+
echo "--- :ruby: Setup Ruby Tools"
15+
install_gems
16+
17+
echo "--- :fire: Create New Hotfix"
18+
bundle exec fastlane new_hotfix_release version:"${RELEASE_VERSION}" skip_confirm:true
19+
agents:
20+
queue: mac
21+
retry:
22+
manual:
23+
reason: If release jobs fail, you should always re-trigger the task from Releases V2 rather than retrying the individual job from Buildkite
24+
allowed: false

0 commit comments

Comments
 (0)