Skip to content

chore(release): v2026.4.3 #25

chore(release): v2026.4.3

chore(release): v2026.4.3 #25

Workflow file for this run

name: Publish to npm
on:
push:
tags:
- "v*.*.*"
permissions:
id-token: write
contents: write
jobs:
publish:
if: github.ref_name == github.event.repository.default_branch || startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
environment: npm-publish
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Extract version from tag
id: extract_version
run: |
TAG=${GITHUB_REF#refs/tags/v}
echo "version=$TAG" >> $GITHUB_OUTPUT
echo "Extracted version: $TAG"
- name: Verify tag format
run: |
VERSION="${{ steps.extract_version.outputs.version }}"
if ! [[ "$VERSION" =~ ^[0-9]{4}\.[0-9]{1,2}\.[0-9]+$ ]]; then
echo "Error: Tag version '$VERSION' does not match YYYY.MM.N format"
exit 1
fi
- name: Verify version matches package.json
run: |
PACKAGE_VERSION=$(node -p "require('./package.json').version")
TAG_VERSION="${{ steps.extract_version.outputs.version }}"
if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then
echo "Error: package.json version ($PACKAGE_VERSION) does not match tag version ($TAG_VERSION)"
exit 1
fi
echo "Version check passed: $PACKAGE_VERSION"
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "22" # Pin to minimum supported version for publishing
registry-url: "https://registry.npmjs.org"
- name: Clean install
run: npm install
- name: Build
run: npm run build --if-present
- name: Run tests
run: npm test
- name: Publish to npm
run: npx clean-publish --access public -- --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Extract release notes from CHANGELOG
run: |
VERSION="${{ steps.extract_version.outputs.version }}"
# Extract compare URL from reference link
COMPARE_URL=$(grep -E "^\[${VERSION}\]: " CHANGELOG.md | sed "s/^\[${VERSION}\]: //")
# Extract body: convert ### to ##, strip --- separators, collapse blank lines
NOTES=$(awk -v ver="$VERSION" '
/^## \[/ {
if (found) exit
if ($0 ~ "\\[" ver "\\]") { found=1; next }
}
/^\[.*\]: https/ { next }
found { print }
' CHANGELOG.md \
| sed 's/^### /## /' \
| sed '/^---$/d' \
| sed '/^$/N;/^\n$/d')
# Combine: Full Changelog link + body
{
if [ -n "$COMPARE_URL" ]; then
printf "**Full Changelog**: %s\n\n" "$COMPARE_URL"
fi
printf '%s\n' "$NOTES"
} > /tmp/release-notes.md
echo "Extracted release notes for v$VERSION"
- name: Create GitHub release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${{ steps.extract_version.outputs.version }}"
gh release create "v${VERSION}" \
--title "v${VERSION}" \
--notes-file /tmp/release-notes.md \
--verify-tag
- name: Verify publish success
run: |
echo "✅ Successfully published linearis@${{ steps.extract_version.outputs.version }}"
echo "📦 Package URL: https://www.npmjs.com/package/linearis"
echo "📋 Release: https://github.com/${{ github.repository }}/releases/tag/v${{ steps.extract_version.outputs.version }}"