Skip to content

Commit f76e97b

Browse files
theinternedkoddssonhmaurer
committed
add a publsih action and prepack script
Co-authored-by: Kristján Oddsson <[email protected]> Co-authored-by: a3gis <[email protected]>
1 parent f2827b7 commit f76e97b

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

.github/workflows/publish.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
publish-npm:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout the project
12+
uses: actions/checkout@v3
13+
- name: Use Node.js 16.x (LTS)
14+
uses: actions/setup-node@v3
15+
with:
16+
node-version: 16.x
17+
registry-url: https://registry.npmjs.org/
18+
cache: npm
19+
- run: npm ci
20+
- run: npm test
21+
- run: npm version ${TAG_NAME} --git-tag-version=false
22+
env:
23+
TAG_NAME: ${{ github.event.release.tag_name }}
24+
- run: npm whoami; npm publish
25+
env:
26+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
"directories": {
99
"test": "test"
1010
},
11+
"files": ["dist"],
1112
"scripts": {
1213
"build": "tsc",
1314
"format": "prettier --write '**/*.ts'",
1415
"lint": "eslint --fix src/**/*.ts",
1516
"package": "ncc build --source-map --license licenses.txt",
17+
"prepack": "npm run build && npm run package",
1618
"test": "jest src",
1719
"test:watch": "jest --watch src",
1820
"all": "npm run build && npm run format && npm run lint && npm run test && npm run package && npm run all:example",

0 commit comments

Comments
 (0)