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
73 changes: 42 additions & 31 deletions .github/workflows/release-package.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,47 @@
name: Node.js Package

on:
release:
types: [created]
release:
types: [created]

jobs:
build-and-publish:
name: Build and Publish to NPM Registry

runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
registry-url: 'https://registry.npmjs.org/'

- name: Install dependencies
run: npm ci

- name: Execute test cases
run: npm test

- name: Build Lib
run: npm run build-lib

- name: Publish to NPM Registry
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
build-and-publish:
name: Build and Publish to NPM Registry

runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
registry-url: 'https://registry.npmjs.org/'

- name: Install dependencies
run: npm ci

- name: Execute test cases
run: npm test

- name: Build Lib
run: npm run build-lib

- name: Publish to NPM Registry
run: |
VERSION=$(node -p "require('./package.json').version")

if [[ $VERSION == *"-beta."* ]]; then
npm publish --access public --tag beta

elif [[ $VERSION == *"-"* ]]; then
npm publish --access public --tag next

else
npm publish --access public
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Comment thread
AbhishekA1509 marked this conversation as resolved.
Dismissed
Loading