Skip to content

Commit 7e4da4e

Browse files
authored
ci: manually push tags and create release (#6439)
1 parent d2e9366 commit 7e4da4e

File tree

4 files changed

+99
-21
lines changed

4 files changed

+99
-21
lines changed

.changeset/pink-actors-think.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@biomejs/biome": patch
3+
---
4+
5+
Fixed an issue where the correct rights aren't added to the binary during publishing

.github/workflows/release.yml

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ jobs:
247247
name: Package JavaScript APIs
248248
runs-on: depot-ubuntu-24.04-arm-16
249249
needs: version
250+
outputs:
251+
version: ${{ needs.version.outputs.js-api-version }}
250252
steps:
251253
- name: Checkout repository
252254
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -332,7 +334,6 @@ jobs:
332334
- name: Install dependencies
333335
run: pnpm install --frozen-lockfile
334336

335-
336337
# The WASM job updates the package.json file, because of wasm-pack, which we need to restore
337338
- name: Restore packages changes
338339
run: |
@@ -344,18 +345,50 @@ jobs:
344345
run: node packages/@biomejs/biome/scripts/copy-binaries.mjs
345346

346347
- name: Publish npm packages as latest
347-
uses: changesets/action@e0145edc7d9d8679003495b11f87bd8ef63c0cba # v1.5.3
348-
with:
349-
publish: pnpm run publish
348+
run: for package in packages/@biomejs/*; do if [ $package != "packages/@biomejs/js-api" ]; then npm publish $package --tag latest --access public --provenance; fi; done
349+
env:
350+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
351+
352+
- name: Publish npm package as latest
353+
run: npm publish packages/@biomejs/js-api --tag latest --access public --provenance
350354
env:
351-
# To publish on npmjs
352355
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
353-
# To push the tags
354-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
355356

356-
- name: Upload assets to the latest tag
357+
- name: Publish release for @biomejs/biome
357358
run: |
358-
files=$(ls biome-* | tr '\n' ' ')
359-
gh release upload @biomejs/biome@${{ needs.build-binaries.outputs.version }} $files
359+
bash scripts/print-changelog.sh ${{ needs.build-binaries.outputs.version }} >| ${{ github.workspace }}/RELEASE_NOTES
360+
361+
- name: Create GitHub @biomejs/biome release and tag
362+
uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2.2.2
363+
env:
364+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
365+
with:
366+
name: |
367+
@biomejs/biome@v${{ needs.build-binaries.outputs.version }}
368+
tag_name: |
369+
@biomejs/biome@v${{ needs.build-binaries.outputs.version }}
370+
draft: false
371+
body_path: ${{ github.workspace }}/RELEASE_NOTES
372+
files: |
373+
biome-*
374+
fail_on_unmatched_files: true
375+
generate_release_notes: true
376+
377+
378+
- name: Publish release for @biomejs/js-api
379+
run: |
380+
bash scripts/print-changelog.sh ${{ needs.build-js-api.outputs.version }} packages/@biomejs/js-api/CHANGELOG.md >| ${{ github.workspace }}/JS_RELEASE_NOTES
381+
382+
- name: Create GitHub @biomejs/js-api release and tag
383+
uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2.2.2
360384
env:
361-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
385+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
386+
with:
387+
name: |
388+
@biomejs/js-api@v${{ needs.build-js-api.outputs.version }}
389+
tag_name: |
390+
@biomejs/js-api@v${{ needs.build-js-api.outputs.version }}
391+
draft: false
392+
body_path: ${{ github.workspace }}/JS_RELEASE_NOTES
393+
fail_on_unmatched_files: true
394+
generate_release_notes: true

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
"check": "cargo biome-cli-dev check",
88
"ci": "cargo biome-cli-dev ci",
99
"//": "when we create the release PR, we need to update the lock file with the new versions",
10-
"version": "changeset version && pnpm i --lockfile-only",
11-
"publish": "changeset publish --no-git-checks"
10+
"version": "changeset version && pnpm i --lockfile-only"
1211
},
1312
"keywords": [],
1413
"author": "Biome Developers and Contributors",

scripts/print-changelog.sh

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,55 @@
11
#!/bin/bash
2-
set -eu
32

4-
# Print a changelog section (default: first section).
3+
# Script to extract changelog section for a specific version
4+
# Usage: ./print-changelog.sh [version] [changelog-file]
55

6-
VERSION=''
6+
# Default values
7+
VERSION=""
8+
CHANGELOG_FILE="packages/@biomejs/biome/CHANGELOG.md"
79

8-
if test -n "${1:-}" && grep -Eq "^## $1($| )" CHANGELOG.md; then
9-
# The specified version has a dedicated section in the changelog
10-
VERSION="$1"
10+
# Parse arguments
11+
if [ $# -eq 0 ]; then
12+
exit 1
1113
fi
1214

13-
# print Changelog of $VERSION
14-
awk -v version="$VERSION" '/^## / { if (p) { exit }; if (version == "" || $2 == version) { p=1; next} } p' CHANGELOG.md
15+
VERSION="$1"
16+
if [ $# -eq 2 ]; then
17+
CHANGELOG_FILE="$2"
18+
fi
19+
20+
# Check if changelog file exists
21+
if [ ! -f "$CHANGELOG_FILE" ]; then
22+
exit 1
23+
fi
24+
25+
# Extract the section for the specified version
26+
awk -v version="$VERSION" '
27+
BEGIN {
28+
found = 0
29+
printing = 0
30+
}
31+
32+
# Found the version header
33+
/^## / {
34+
if ($2 == version) {
35+
found = 1
36+
printing = 1
37+
print
38+
next
39+
} else if (printing) {
40+
# Found next version section, stop printing
41+
exit
42+
}
43+
}
44+
45+
# Print lines when we are in the target version section
46+
printing {
47+
print
48+
}
49+
50+
END {
51+
if (!found) {
52+
exit 1
53+
}
54+
}
55+
' "$CHANGELOG_FILE"

0 commit comments

Comments
 (0)