Skip to content

Commit

Permalink
🔧 chore(npm.yml): add caching of node_modules to improve build perfor…
Browse files Browse the repository at this point in the history
…mance

✨ feat(npm.yml): set up .npmrc file for authentication to enable publishing package on NPM
🚀 ci(npm.yml): update npm publish command to publish package with public access
  • Loading branch information
tareq1988 committed Sep 24, 2023
1 parent 850157a commit 13f848a
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion .github/workflows/npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,34 @@ name: Publish to NPM
on:
release:
types: [created]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '16'

- name: Cache node_modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Build
run: yarn install && yarn build

- name: Set up .npmrc file for authentication
run: echo "registry=https://registry.npmjs.org/" >> .npmrc && echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> .npmrc

- name: Publish package on NPM
run: npm publish
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit 13f848a

Please sign in to comment.