Skip to content
Open
Show file tree
Hide file tree
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
70 changes: 0 additions & 70 deletions .github/workflows/github-release.yml

This file was deleted.

58 changes: 47 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,60 @@
# This workflow will publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Publish package to NPM repository
name: Publish package to npmjs registry
on:
release:
types: [created]
types: [published]
Comment thread
cs-raj marked this conversation as resolved.

jobs:
publish-npm:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event.release.tag_name }}
persist-credentials: false
- uses: actions/setup-node@v7
with:
node-version: 24
registry-url: https://registry.npmjs.org/
cache: 'npm'
- name: Check the release tag matches package.json
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
run: |
PKG_VERSION="v$(node -p "require('./package.json').version")"
if [ "$RELEASE_TAG" != "$PKG_VERSION" ]; then
echo "::error::release tag $RELEASE_TAG does not match package.json version $PKG_VERSION"
exit 1
fi
- run: npm ci
- run: npm run build-ts
- name: Update npm
run: npm install -g npm@latest
- name: Release
run: npm publish --access public --tag ${{ github.event.release.prerelease && 'beta' || 'latest' }}

upload-release-asset:
runs-on: ubuntu-latest
needs: publish-npm
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
with:
ref: ${{ github.event.release.tag_name }}
- uses: actions/setup-node@v4
persist-credentials: false
- uses: actions/setup-node@v7
with:
node-version: "22.x"
registry-url: "https://registry.npmjs.org"
node-version: 24
cache: 'npm'
- run: npm ci
- run: npm run build-ts
- run: npm publish --tag latest --access public
- name: Pack
run: npm pack
- name: Attach the tarball to the release
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ github.event.release.tag_name }}
run: gh release upload "$RELEASE_TAG" ./*.tgz --clobber
Loading
Loading