diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5db57b97c..431fff4e8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,10 +58,10 @@ jobs: - name: Checkout repo uses: actions/checkout@v4 - - name: Setup Node.js 22.x + - name: Setup Node.js 24.x uses: actions/setup-node@v4 with: - node-version: 22.x + node-version: '>=24.18.0 <25' cache: yarn - name: Install dependencies @@ -70,6 +70,10 @@ jobs: - name: 🏗 Run build script run: yarn build + - name: Enable npm staged publishing + run: | + echo "$GITHUB_WORKSPACE/scripts/wrap-staged" >> "$GITHUB_PATH" + - name: 🚀 Release uses: cycjimmy/semantic-release-action@v4 with: diff --git a/scripts/wrap-staged/npm b/scripts/wrap-staged/npm new file mode 100755 index 000000000..fc12f39e5 --- /dev/null +++ b/scripts/wrap-staged/npm @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# Route publishing through npm's staging queue; forward other commands unchanged. +set -euo pipefail + +# execa may prepend local bin directories before this wrapper's PATH entry. +wrapper_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" +remaining_path=":$PATH:" +while [[ "$remaining_path" == *":$wrapper_dir:"* ]]; do + remaining_path="${remaining_path//":$wrapper_dir:"/:}" +done +remaining_path="${remaining_path#:}" +export PATH="${remaining_path%:}" + +if [[ "${1:-}" == "publish" ]]; then + shift + exec npm stage publish "$@" +fi + +exec npm "$@"