Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
# Publish to npm when a release is published or manually triggered.
# Also verifies version consistency, runs linters, builds the package, and publishes with provenance.
name: Publish to npm

on:
release:
types: [published] # triggers when a GitHub Release is published
workflow_dispatch: # allows manual trigger from Actions tab
types: [published]
workflow_dispatch:

jobs:
publish:
name: Build & Publish
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # required for npm provenance
id-token: write

steps:
- name: Checkout repository
Expand All @@ -33,12 +31,11 @@ jobs:
if: github.event_name == 'release'
run: |
PACKAGE_VERSION=$(node -p "require('./package.json').version")
RELEASE_TAG=${github.event.release.tag_name}
if [ "$PACKAGE_VERSION" != "$RELEASE_TAG" ]; then
echo "❌ Package version ($PACKAGE_VERSION) does not match release tag ($RELEASE_TAG)"
if [ "$PACKAGE_VERSION" != "$GITHUB_REF_NAME" ]; then
echo "❌ Package version ($PACKAGE_VERSION) does not match release tag ($GITHUB_REF_NAME)"
exit 1
fi
echo "✅ Package version $PACKAGE_VERSION matches release tag $RELEASE_TAG"
echo "✅ Package version $PACKAGE_VERSION matches release tag $GITHUB_REF_NAME"

- name: Run Stylelint (CSS linting)
run: npm run lint
Expand Down