-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (37 loc) · 1.13 KB
/
release.yml
File metadata and controls
47 lines (37 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Release (npm)
on:
push:
branches: [ main ] # run on main pushes (build/test only)
tags: [ 'v*' ] # run on version tags (full release)
permissions:
contents: write # needed to create GitHub Releases
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
cache: npm
- name: Install
run: npm ci
- name: Test
run: npm test
- name: Build
run: npm run build
# Only publish to npm on version tags (refs/tags/vX.Y.Z)
- name: Publish to npm
if: startsWith(github.ref, 'refs/tags/v')
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access public
# Only create a GitHub Release on version tags
- name: Create GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true