Skip to content

Commit 8f6b394

Browse files
authored
Merge pull request #16 from github/theinterned/publish-action
Add a publish action and prepack script
2 parents f2827b7 + c3a0e0e commit 8f6b394

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

.github/workflows/publish.yml

+26
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

+2
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)