Skip to content

Commit ed93310

Browse files
authored
Add build and publish (#4)
Does what it says on the tin, adding automation to publish a new version.
1 parent b13168b commit ed93310

7 files changed

Lines changed: 3769 additions & 6 deletions

File tree

.github/workflows/build_npm.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Build
2+
3+
permissions:
4+
issues: write
5+
pull-requests: write
6+
7+
on:
8+
pull_request:
9+
push:
10+
branches:
11+
- main
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: 20
21+
- run: npm ci --ignore-scripts
22+
- name: 'Test'
23+
run: npx vitest --coverage.enabled true
24+
- name: 'Report Coverage'
25+
if: ${{ !cancelled() }}
26+
uses: davelosert/vitest-coverage-report-action@v2

.github/workflows/publish_npm.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Publish Package to npmjs
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
environment: publish
11+
steps:
12+
- uses: actions/checkout@v4
13+
# Setup .npmrc file to publish to npm
14+
- uses: actions/setup-node@v4
15+
with:
16+
node-version: 20
17+
registry-url: 'https://registry.npmjs.org'
18+
- run: npm ci --ignore-scripts
19+
- run: npm run build
20+
- run: npm publish --ignore-scripts
21+
env:
22+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ coverage/
22
dist/
33
node_modules/
44
tsconfig.tsbuildinfo
5-
package-lock.json

0 commit comments

Comments
 (0)