add workflow to publish to npm

This commit is contained in:
2023-11-15 17:07:26 +01:00
parent e56f91565f
commit fd0aae5f0c
2 changed files with 30 additions and 1 deletions

29
.github/workflows/publish.yml vendored Normal file
View File

@@ -0,0 +1,29 @@
name: Publish to NPM
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Build lib
run: pnpm run build
- name: Publish package on NPM 📦
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

View File

@@ -1,5 +1,5 @@
{
"name": "bundlers",
"name": "@ershisan99/lib-demo",
"private": true,
"version": "0.0.0",
"main": "./dist/index.js",