Skip to content

Commit

Permalink
Create npm_release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
lmangani authored Oct 24, 2024
1 parent d850548 commit c7a5112
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/npm_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: 'NPM CI+CD'

on:
release:
types: [published]

jobs:
build:
name: 'Build & Publish'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1
with:
ref: ${{ github.ref }}
- name: Update Package to Release version
uses: technote-space/package-version-check-action@v1.9.3
- name: Check NPM secret presence
id: checksecrets
shell: bash
run: |
if [ "$SECRET" == "" ]; then
echo "secretspresent=false" >> $GITHUB_OUTPUT
else
echo "secretspresent=true" >> $GITHUB_OUTPUT
fi
env:
SECRET: ${{ secrets.NPM_TOKEN }}
- uses: actions/setup-node@v4.0.1
if: ${{ steps.checksecrets.outputs.secretspresent }}
with:
node-version: 20
- name: Publish to NPM
if: ${{ steps.checksecrets.outputs.secretspresent }}
continue-on-error: false
run: |
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
npm install
npm publish --access public
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}


0 comments on commit c7a5112

Please sign in to comment.