Skip to content

Commit ff19fdc

Browse files
author
Zack Chase
authored
Release v0.6.0 (#134)
* Update release script * Release v0.6.0 * Update release guide * Update command name
1 parent b1c7046 commit ff19fdc

10 files changed

Lines changed: 75 additions & 106 deletions

File tree

README.md

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -113,48 +113,43 @@ All SDKs version on the same cadence. To publish a new version (of all SDKs), fo
113113

114114
1. Update the `VERSION_FROM` and `VERSION_TO` values in the `release:all` task in [`./project.json`](./project.json).
115115

116-
1. Leaving that single change uncommitted, make sure you've exported a GitHub access token (as `GITHUB_TOKEN` -- see below) with push access to `main` branch of the repository, then run the release script:
116+
1. Leaving that single change uncommitted and run the release script:
117117

118118
```bash
119-
npm run release
119+
npm run release:create-branch
120120
```
121121

122122
This script:
123123

124124
- Updates the version numbers in all affected files
125125
- Rebuilds all SDKs
126126
- Commits all changes (e.g., to version files, lockfiles, and anything else under `./sdk`)
127-
- Adds two new tags to mark the release (`v0.0.0` and `sdk/go/v0.0.0`)
128-
- Pushes the commit and tags to GitHub, triggering the `publish` task
129-
- Creates a new GitHub release
127+
- Pushes the branch to GitHub
130128

131-
If for some reason the Buildkite publish job doesn't finish successfully, you can run some or all publish tasks from your local machine by exporting the applicable environment variables (again, see below), then running:
129+
1. Next open a PR with the created branch.
130+
131+
1. After the PR is merged, from an up-to-date main branch, create and push the release tags:
132132

133133
```bash
134-
npm run clean
135-
npm run build
136-
npm run publish # To publish all packages
137-
npx nx publish sdk/typescript # To publish only the Node.js package
138-
npx nx publish sdk/python # To publish only the Python package
139-
npx nx publish sdk/go # To publish only the Go package
140-
npx nx publish sdk/ruby # To publish only the Ruby package
134+
git tag v{VERSION_TO} main
135+
git tag sdk/go/v{VERSION_TO} main
136+
137+
git push origin v{VERSION_TO}
138+
git push origin sdk/go/v{VERSION_TO}
141139
```
142140

143-
1. Once the `publish` job completes, verify the releases at their respective URLs:
141+
1. Once the tags have been created, manually trigger the SDK Release Pipeline in Buildkite. After the pipeline has finished, manually create a release in GitHub ([example](https://github.com/buildkite/buildkite-sdk/releases/tag/v0.5.0)).
142+
143+
### Docs
144144

145-
- https://github.com/buildkite/buildkite-sdk/releases
146-
- https://www.npmjs.com/package/@buildkite/buildkite-sdk
147-
- https://pypi.org/project/buildkite-sdk/
148-
- https://pkg.go.dev/github.com/buildkite/buildkite-sdk/sdk/go (this usually takes a minute or two)
149-
- https://rubygems.org/gems/buildkite-sdk
145+
The SDK language docs are managed by a Pulumi Program in `infra` and manually deployed after every release.
150146

151147
### Required environment variables
152148

153149
The following environment variables are required for releasing and publishing:
154150

155-
- `GITHUB_TOKEN` for creating GitHub releases (with `@octokit/rest`)
156151
- `NPM_TOKEN` for publishing to npm (with `npm publish`)
157152
- `PYPI_TOKEN` fror publishing to PyPI (with `uv publish`)
158153
- `GEM_HOST_API_KEY` for publishing to RubyGems (with `gem push`)
159154

160-
See the `publish:all` and `release:all` tasks in `./project.json` for details.
155+
See the `publish:all` tasks in `./project.json` for details.

create-release-branch.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
const [from, to] = [process.argv[2], process.argv[3]];
2+
3+
if (!from || !to) {
4+
console.error(`Invalid 'from' or 'to' version: '${from}', '${to}'`);
5+
process.exit(1);
6+
}
7+
8+
(async () => {
9+
const { replaceInFileSync } = await import("replace-in-file");
10+
const { simpleGit } = await import("simple-git");
11+
const { execSync } = await import("child_process");
12+
13+
const paths = [
14+
"sdk/go/project.json",
15+
"sdk/python/pyproject.toml",
16+
"sdk/typescript/package.json",
17+
"sdk/ruby/lib/buildkite/version.rb",
18+
"sdk/ruby/project.json",
19+
];
20+
21+
const git = simpleGit();
22+
const branch = `release/v${to}`;
23+
24+
await git.checkoutLocalBranch(branch);
25+
26+
// Bump versions.
27+
replaceInFileSync({
28+
files: paths,
29+
from,
30+
to,
31+
});
32+
33+
// Build all SDKs.
34+
execSync("npm run build", { stdio: "inherit" });
35+
36+
// Commit and tag.
37+
await git.add("sdk"); // Include everything here, as lockfiles will also have changed.
38+
await git.add("project.json"); // As this contains the new version.
39+
await git.commit(`Release v${to}`);
40+
41+
// Push the commit.
42+
await git.push("origin", branch);
43+
44+
console.log("Release branch created");
45+
})();

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"watch": "npx nx watch --all -- nx rebuild:all",
2323
"format": "npx nx format:all",
2424
"dev": "concurrently 'npm run docs:serve' 'npm run watch' --kill-others",
25-
"release": "npx nx release:all"
25+
"release:create-branch": "npx nx release:create-branch"
2626
},
2727
"private": true,
2828
"devDependencies": {

project.json

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -120,18 +120,14 @@
120120
"options": {
121121
"commands": []
122122
},
123-
"dependsOn": [
124-
"ci:run:pipeline"
125-
]
123+
"dependsOn": ["ci:run:pipeline"]
126124
},
127125
"gen:pipeline-release": {
128126
"executor": "nx:run-commands",
129127
"options": {
130128
"commands": []
131129
},
132-
"dependsOn": [
133-
"ci:run:release-pipeline"
134-
]
130+
"dependsOn": ["ci:run:release-pipeline"]
135131
},
136132
"build:all": {
137133
"dependsOn": [
@@ -192,13 +188,15 @@
192188
"rebuild:all": {
193189
"dependsOn": ["build:all", "docs:all", "run:all"]
194190
},
195-
"release:all": {
191+
"release:create-branch": {
196192
"executor": "nx:run-commands",
197193
"options": {
198-
"commands": ["node ./release.js $VERSION_FROM $VERSION_TO"],
194+
"commands": [
195+
"node ./create-release-branch.js $VERSION_FROM $VERSION_TO"
196+
],
199197
"env": {
200-
"VERSION_FROM": "0.4.1",
201-
"VERSION_TO": "0.5.0"
198+
"VERSION_FROM": "0.5.0",
199+
"VERSION_TO": "0.6.0"
202200
}
203201
}
204202
}

release.js

Lines changed: 0 additions & 69 deletions
This file was deleted.

sdk/go/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
],
5757
"env": {
5858
"GOPROXY": "proxy.golang.org",
59-
"VERSION": "0.5.0"
59+
"VERSION": "0.6.0"
6060
}
6161
},
6262
"cache": false

sdk/python/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ addopts = "--cov --cov-report html:'../../../coverage/sdk/python/html' --cov-rep
1111

1212
[project]
1313
name = "buildkite-sdk"
14-
version = "0.5.0"
14+
version = "0.6.0"
1515
description = "Automatically generated by Nx."
1616
requires-python = ">=3.10,<4"
1717
readme = "README.md"

sdk/ruby/lib/buildkite/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Buildkite
2-
VERSION = "0.5.0".freeze
2+
VERSION = "0.6.0".freeze
33
end

sdk/ruby/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"commands": ["gem push buildkite-sdk-$VERSION.gem"],
4949
"cwd": "dist/sdks/ruby",
5050
"env": {
51-
"VERSION": "0.5.0"
51+
"VERSION": "0.6.0"
5252
}
5353
},
5454
"cache": false

sdk/typescript/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@buildkite/buildkite-sdk",
3-
"version": "0.5.0",
3+
"version": "0.6.0",
44
"dependencies": {
55
"tslib": "^2.3.0",
66
"yaml": "^2.6.1"

0 commit comments

Comments
 (0)