Skip to content

Commit

Permalink
Merge pull request #27 from delanni/add-publish-workflow
Browse files Browse the repository at this point in the history
Add a workflow to publish the library on npm
  • Loading branch information
delanni authored Dec 13, 2024
2 parents 2feaaf3 + 473e03f commit b2e9d4d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
28 changes: 28 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Publish to npm

on:
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest

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

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '20.x'

- name: Install dependencies
run: npm install

- name: Build the project
run: npm run build

- name: Publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# .npmrc file to handle npm authentication
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"scripts": {
"test": "jest",
"build": "tsc",
"ci": "npm run build && npm test"
"ci": "npm run build && npm test",
"publish": "npm publish"
},
"author": "Alex Szabo ([email protected])",
"license": "MIT",
Expand Down

0 comments on commit b2e9d4d

Please sign in to comment.