Skip to content

Commit

Permalink
ci: add script to correctly update packages during the release (#3423)
Browse files Browse the repository at this point in the history
  • Loading branch information
ematipico authored Jul 15, 2024
1 parent e16e2a2 commit fbc101d
Show file tree
Hide file tree
Showing 18 changed files with 182 additions and 72 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release_knope.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,11 @@ jobs:
registry-url: 'https://registry.npmjs.org'

- name: Publish npm packages as latest
run: for package in packages/@biomejs/*; do if [ $package != "packages/@biomejs/js-api" ]; then npm publish $package --tag latest --access public --provenance; fi; done
run: for package in packages/@biomejs/*; do if [ $package != "packages/@biomejs/js-api" ]; then npm publish $package --tag latest --access public; fi; done
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish npm packages as nightly
run: for package in packages/@biomejs/*; do if [ $package != "packages/@biomejs/js-api" ]; then npm publish $package --tag nightly --access public --provenance; fi; done
run: for package in packages/@biomejs/*; do if [ $package != "packages/@biomejs/js-api" ]; then npm publish $package --tag nightly --access public; fi; done
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Expand Down
9 changes: 6 additions & 3 deletions knope.toml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ name = "document-change"

[[workflows.steps]]
type = "CreateChangeFile"

# end-workflow

# Workflow that creates a PR via GitHub actions. This PR will contain all the changes for a release: changelogs, version numbers, etc.
# Refernce: https://knope.tech/recipes/1-preview-releases-with-pull-requests/#prepare-release-workflow
Expand All @@ -239,6 +239,7 @@ type = "Command"
command = "git commit -m \"chore: prepare release\""

[[workflows.steps]]
# WARNING: if you change the name of the branch, update `prepare_release.yml` too
command = "git push --force-with-lease --set-upstream origin release/automated-ci"
type = "Command"

Expand All @@ -250,15 +251,16 @@ type = "CreatePullRequest"
template = "chore: prepare release"

[workflows.steps.body]
template = "This PR was created by Knope. Merging it will create a new release"
template = "This PR was automatically created via workflow. Merging it will create a new release of the Biome packages and crates."
# end-workflow

# The release workflow that will run in CI. It is triggered when the prepare-release PR is merged
[[workflows]]
name = "release"

[[workflows.steps]]
# The script will add most up-to-date optional dependencies to the manifest of @biomejs/biome and @biomejs/backend-jsonrpc
command = "node packages/@biomejs/biome/scripts/generate-packages.mjs"
command = "node scripts/generate-packages.mjs"
type = "Command"

[[workflows.steps]]
Expand All @@ -268,3 +270,4 @@ type = "Release"
[github]
owner = "biomejs"
repo = "biome"
# end-workflow
21 changes: 12 additions & 9 deletions packages/@biomejs/backend-jsonrpc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@biomejs/backend-jsonrpc",
"version": "1.7.3",
"version": "1.9.3",
"main": "dist/index.js",
"scripts": {
"test": "vitest",
Expand Down Expand Up @@ -41,14 +41,17 @@
"vite": "5.3.3",
"vitest": "1.6.0"
},
"publishConfig": {
"provenance": true
},
"optionalDependencies": {
"@biomejs/cli-win32-x64": "1.8.3",
"@biomejs/cli-win32-arm64": "1.8.3",
"@biomejs/cli-darwin-x64": "1.8.3",
"@biomejs/cli-darwin-arm64": "1.8.3",
"@biomejs/cli-linux-x64": "1.8.3",
"@biomejs/cli-linux-arm64": "1.8.3",
"@biomejs/cli-linux-x64-musl": "1.8.3",
"@biomejs/cli-linux-arm64-musl": "1.8.3"
"@biomejs/cli-win32-x64": "1.9.3",
"@biomejs/cli-win32-arm64": "1.9.3",
"@biomejs/cli-darwin-x64": "1.9.3",
"@biomejs/cli-darwin-arm64": "1.9.3",
"@biomejs/cli-linux-x64": "1.9.3",
"@biomejs/cli-linux-arm64": "1.9.3",
"@biomejs/cli-linux-x64-musl": "1.9.3",
"@biomejs/cli-linux-arm64-musl": "1.9.3"
}
}
3 changes: 3 additions & 0 deletions packages/@biomejs/biome/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
"type": "opencollective",
"url": "https://opencollective.com/biome"
},
"publishConfig": {
"provenance": true
},
"optionalDependencies": {
"@biomejs/cli-win32-x64": "1.8.3",
"@biomejs/cli-win32-arm64": "1.8.3",
Expand Down
8 changes: 5 additions & 3 deletions packages/@biomejs/biome/scripts/generate-packages.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ function copyBinaryToNativePackage(platform, arch) {
);
const binaryTarget = resolve(packageRoot, `biome${ext}`);

console.log(`Copy binary ${binaryTarget}`);
fs.copyFileSync(binarySource, binaryTarget);
fs.chmodSync(binaryTarget, 0o755);
if (fs.existsSync(binaryTarget)) {
console.log(`Copy binary ${binaryTarget}`);
fs.copyFileSync(binarySource, binaryTarget);
fs.chmodSync(binaryTarget, 0o755);
}
}

function updateWasmPackage(target) {
Expand Down
2 changes: 1 addition & 1 deletion packages/@biomejs/cli-darwin-arm64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@biomejs/cli-darwin-arm64",
"version": "1.7.3",
"version": "1.8.3",
"license": "MIT OR Apache-2.0",
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions packages/@biomejs/cli-darwin-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@biomejs/cli-darwin-arm64",
"version": "1.7.3",
"name": "@biomejs/cli-darwin-x64",
"version": "1.8.3",
"license": "MIT OR Apache-2.0",
"repository": {
"type": "git",
Expand Down
6 changes: 3 additions & 3 deletions packages/@biomejs/cli-linux-arm64-musl/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "@biomejs/cli-darwin-arm64",
"version": "1.7.3",
"name": "@biomejs/cli-linux-arm64-musl",
"version": "1.8.3",
"license": "MIT OR Apache-2.0",
"repository": {
"type": "git",
"url": "git+https://github.com/biomejs/biome.git",
"directory": "packages/@biomejs/biome"
"directory": "packages/@biomejs/biome/cli-linux-arm64-musl"
},
"engines": {
"node": ">=14.21.3"
Expand Down
9 changes: 6 additions & 3 deletions packages/@biomejs/cli-linux-arm64/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "@biomejs/cli-darwin-arm64",
"version": "1.7.3",
"name": "@biomejs/cli-linux-arm64",
"version": "1.8.3",
"license": "MIT OR Apache-2.0",
"repository": {
"type": "git",
"url": "git+https://github.com/biomejs/biome.git",
"directory": "packages/@biomejs/biome"
"directory": "packages/@biomejs/biome/cli-linux-arm64"
},
"engines": {
"node": ">=14.21.3"
Expand All @@ -16,5 +16,8 @@
],
"cpu": [
"arm64"
],
"libc": [
"glibc"
]
}
6 changes: 3 additions & 3 deletions packages/@biomejs/cli-linux-x64-musl/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "@biomejs/cli-darwin-arm64",
"version": "1.7.3",
"name": "@biomejs/cli-linux-x64-musl",
"version": "1.8.3",
"license": "MIT OR Apache-2.0",
"repository": {
"type": "git",
"url": "git+https://github.com/biomejs/biome.git",
"directory": "packages/@biomejs/biome"
"directory": "packages/@biomejs/biome/cli-linux-x64-musl"
},
"engines": {
"node": ">=14.21.3"
Expand Down
9 changes: 6 additions & 3 deletions packages/@biomejs/cli-linux-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "@biomejs/cli-darwin-arm64",
"version": "1.7.3",
"name": "@biomejs/cli-linux-x64",
"version": "1.8.3",
"license": "MIT OR Apache-2.0",
"repository": {
"type": "git",
"url": "git+https://github.com/biomejs/biome.git",
"directory": "packages/@biomejs/biome"
"directory": "packages/@biomejs/biome/cli-linux-x64"
},
"engines": {
"node": ">=14.21.3"
Expand All @@ -16,5 +16,8 @@
],
"cpu": [
"x64"
],
"libc": [
"glibc"
]
}
6 changes: 3 additions & 3 deletions packages/@biomejs/cli-win32-arm64/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "@biomejs/cli-darwin-arm64",
"version": "1.7.3",
"name": "@biomejs/cli-win32-arm64",
"version": "1.8.3",
"license": "MIT OR Apache-2.0",
"repository": {
"type": "git",
"url": "git+https://github.com/biomejs/biome.git",
"directory": "packages/@biomejs/biome"
"directory": "packages/@biomejs/biome/cli-win32-arm64"
},
"engines": {
"node": ">=14.21.3"
Expand Down
6 changes: 3 additions & 3 deletions packages/@biomejs/cli-win32-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "@biomejs/cli-darwin-arm64",
"version": "1.7.3",
"name": "@biomejs/cli-win32-x64",
"version": "1.8.3",
"license": "MIT OR Apache-2.0",
"repository": {
"type": "git",
"url": "git+https://github.com/biomejs/biome.git",
"directory": "packages/@biomejs/biome"
"directory": "packages/@biomejs/biome/cli-win32-x64"
},
"engines": {
"node": ">=14.21.3"
Expand Down
10 changes: 7 additions & 3 deletions packages/@biomejs/wasm-bundler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
"Biome Developers and Contributors"
],
"description": "WebAssembly bindings to the Biome workspace API",
"version": "1.7.3",
"version": "1.8.3",
"license": "MIT OR Apache-2.0",
"repository": {
"type": "git",
"url": "git+https://github.com/biomejs/biome.git"
"url": "git+https://github.com/biomejs/biome.git",
"directory": "packages/@biomejs/biome/wasm-bundler"
},
"files": [
"biome_wasm_bg.wasm",
Expand All @@ -18,6 +19,9 @@
],
"module": "biome_wasm.js",
"homepage": "https://biomejs.dev/",
"publishConfig": {
"provenance": true
},
"types": "biome_wasm.d.ts",
"sideEffects": [
"./biome_wasm.js",
Expand All @@ -29,4 +33,4 @@
"formatter",
"wasm"
]
}
}
10 changes: 7 additions & 3 deletions packages/@biomejs/wasm-nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
"Biome Developers and Contributors"
],
"description": "WebAssembly bindings to the Biome workspace API",
"version": "1.7.3",
"version": "1.8.3",
"license": "MIT OR Apache-2.0",
"repository": {
"type": "git",
"url": "git+https://github.com/biomejs/biome.git"
"url": "git+https://github.com/biomejs/biome.git",
"directory": "packages/@biomejs/biome/wasm-nodejs"
},
"files": [
"biome_wasm_bg.wasm",
Expand All @@ -17,10 +18,13 @@
],
"main": "biome_wasm.js",
"homepage": "https://biomejs.dev/",
"publishConfig": {
"provenance": true
},
"types": "biome_wasm.d.ts",
"keywords": [
"parser",
"linter",
"formatter"
]
}
}
10 changes: 7 additions & 3 deletions packages/@biomejs/wasm-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
"Biome Developers and Contributors"
],
"description": "WebAssembly bindings to the Biome workspace API",
"version": "1.7.3",
"version": "1.8.3",
"license": "MIT OR Apache-2.0",
"repository": {
"type": "git",
"url": "git+https://github.com/biomejs/biome.git"
"url": "git+https://github.com/biomejs/biome.git",
"directory": "packages/@biomejs/biome/wasm-web"
},
"files": [
"biome_wasm_bg.wasm",
Expand All @@ -17,6 +18,9 @@
],
"module": "biome_wasm.js",
"homepage": "https://biomejs.dev/",
"publishConfig": {
"provenance": true
},
"types": "biome_wasm.d.ts",
"sideEffects": [
"./snippets/*"
Expand All @@ -27,4 +31,4 @@
"formatter",
"wasm"
]
}
}
25 changes: 0 additions & 25 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fbc101d

Please sign in to comment.