From d66ff9ca110b76a4fd55ce34139cea851e3d3de3 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Thu, 4 Sep 2025 13:05:50 -0500 Subject: [PATCH] Add npm publish action --- .github/workflows/publish.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..6d88b10 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,28 @@ +name: Publish Package to npmjs +on: + release: + types: [published] + +permissions: + contents: read + id-token: write + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: '22.x' + registry-url: 'https://registry.npmjs.org' + - name: Verify tag matches version + run: | + VERSION=$(node -p "require('./package.json').version") + TAG=${GITHUB_REF_NAME#v} + if [ "$VERSION" != "$TAG" ]; then + echo "Release tag does not match version in package.json" + exit 1 + fi + - run: npm ci --ignore-scripts + - run: npm publish --provenance