chore(release): v0.53.0 #66
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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@250f29ce396baf5e8f24498e17c0dfdebabc26eb # v1 | |
| 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@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Publish packages to npm | |
| run: | | |
| TAG="${{ inputs.version || github.ref_name }}" | |
| 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 | |
| run: | | |
| TAG="${{ inputs.version || github.ref_name }}" | |
| 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 }} | |
| run: | | |
| TAG="${{ inputs.version || github.ref_name }}" | |
| PRERELEASE_FLAG="" | |
| if [[ "$TAG" == *-* ]]; then | |
| PRERELEASE_FLAG="--prerelease" | |
| fi | |
| gh release create "$TAG" \ | |
| --title "$TAG" \ | |
| --notes-file /tmp/release-body.md \ | |
| $PRERELEASE_FLAG |