Skip to content

Commit

Permalink
Automate npm publish npm via actions
Browse files Browse the repository at this point in the history
  • Loading branch information
sibiraj-s committed Oct 27, 2021
1 parent 7cfd468 commit f027138
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
41 changes: 41 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: NPM Publish

env:
NODE_VERSION: 16

on:
push:
tags: v*

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: https://registry.npmjs.org/
cache: npm

- run: node --version
- run: npm --version

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build
env:
NODE_ENV: production

- name: Tests
run: npm run test

- name: Publish to NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

- uses: actions/setup-node@v2
with:
node-version: ${{env.NODE_VERSION}}
node-version: ${{ env.NODE_VERSION }}
cache: npm

- run: node --version
Expand Down

0 comments on commit f027138

Please sign in to comment.