Skip to content

Commit 3e9388d

Browse files
committed
chore: use staged publishing
1 parent 9f04ecd commit 3e9388d

2 files changed

Lines changed: 25 additions & 2 deletions

File tree

  • .github/workflows
  • scripts/wrap-staged

‎.github/workflows/ci.yml‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ jobs:
5858
- name: Checkout repo
5959
uses: actions/checkout@v4
6060

61-
- name: Setup Node.js 22.x
61+
- name: Setup Node.js 24.x
6262
uses: actions/setup-node@v4
6363
with:
64-
node-version: 22.x
64+
node-version: '>=24.18.0 <25'
6565
cache: yarn
6666

6767
- name: Install dependencies
@@ -70,6 +70,10 @@ jobs:
7070
- name: 🏗 Run build script
7171
run: yarn build
7272

73+
- name: Enable npm staged publishing
74+
run: |
75+
echo "$GITHUB_WORKSPACE/scripts/wrap-staged" >> "$GITHUB_PATH"
76+
7377
- name: 🚀 Release
7478
uses: cycjimmy/semantic-release-action@v4
7579
with:

‎scripts/wrap-staged/npm‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
# Route publishing through npm's staging queue; forward other commands unchanged.
3+
set -euo pipefail
4+
5+
# execa may prepend local bin directories before this wrapper's PATH entry.
6+
wrapper_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
7+
remaining_path=":$PATH:"
8+
while [[ "$remaining_path" == *":$wrapper_dir:"* ]]; do
9+
remaining_path="${remaining_path//":$wrapper_dir:"/:}"
10+
done
11+
remaining_path="${remaining_path#:}"
12+
export PATH="${remaining_path%:}"
13+
14+
if [[ "${1:-}" == "publish" ]]; then
15+
shift
16+
exec npm stage publish "$@"
17+
fi
18+
19+
exec npm "$@"

0 commit comments

Comments
 (0)