Skip to content

chore(release): v0.54.0 #67

chore(release): v0.54.0

chore(release): v0.54.0 #67

Workflow file for this run

name: Publish
on:
push:
tags:
- v*.*.*
- v*.*.*-*
workflow_dispatch:
inputs:
version:
description: "Version tag to publish (e.g., v0.52.0)"
required: true
type: string
permissions: {}
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
publish:
name: Publish to npm
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write # for creating GitHub releases
id-token: write # for npm OIDC provenance
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: voidzero-dev/setup-vp@313600b80b104eadebb9111787d37a2e83e014ca # v1.17.0
with:
node-version-file: ".node-version"
cache: true
- name: Install dependencies
run: vp install
- name: Prebuild
run: cp README.md packages/core/README.md && cp README.md packages/react/README.md
- name: Build packages
run: vp run -r build
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
registry-url: "https://registry.npmjs.org"
# Publishing workflow: never restore a potentially poisoned cache.
package-manager-cache: false
- name: Publish packages to npm
env:
TAG: ${{ inputs.version || github.ref_name }}
run: |
VERSION="${TAG#v}"
# Determine npm dist-tag from version string
if [[ "$VERSION" == *-* ]]; then
DIST_TAG=$(echo "$VERSION" | sed 's/.*-\([a-zA-Z]*\).*/\1/')
else
DIST_TAG="latest"
fi
echo "Publishing version $VERSION with dist-tag: $DIST_TAG"
FAILED=0
for pkg_dir in packages/*/; do
pkg_json="${pkg_dir}package.json"
is_private=$(node -e "console.log(JSON.parse(require('fs').readFileSync('${pkg_json}','utf8')).private || false)")
pkg_name=$(node -e "console.log(JSON.parse(require('fs').readFileSync('${pkg_json}','utf8')).name)")
if [ "$is_private" = "true" ]; then
echo "⏭️ Skipping private package: $pkg_name"
continue
fi
echo "📦 Publishing $pkg_name@$VERSION..."
PUBLISH_OUTPUT=$(cd "$pkg_dir" && vp pm publish -- --access public --tag "$DIST_TAG" --provenance --no-git-checks 2>&1) && true
PUBLISH_EXIT=$?
echo "$PUBLISH_OUTPUT"
if [ "$PUBLISH_EXIT" -ne 0 ]; then
if echo "$PUBLISH_OUTPUT" | grep -q "previously published\|already exists\|Cannot publish over"; then
echo "⚠️ $pkg_name@$VERSION already published, skipping."
else
echo "❌ Failed to publish $pkg_name"
FAILED=1
fi
fi
done
if [ "$FAILED" -eq 1 ]; then
echo "::error::One or more packages failed to publish."
exit 1
fi
- name: Postpublish cleanup
run: rm -rf packages/core/README.md packages/react/README.md
- name: Prepare release notes
env:
TAG: ${{ inputs.version || github.ref_name }}
run: |
VERSION="${TAG#v}"
# Derive the release body from the matching CHANGELOG.md section, so
# the GitHub Release notes always match what was authored there.
node scripts/extract-changelog.mjs "$VERSION" /tmp/release-body.md
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ inputs.version || github.ref_name }}
run: |
PRERELEASE_FLAG=""
if [[ "$TAG" == *-* ]]; then
PRERELEASE_FLAG="--prerelease"
fi
gh release create "$TAG" \
--title "$TAG" \
--notes-file /tmp/release-body.md \
$PRERELEASE_FLAG