-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (42 loc) · 1.04 KB
/
main.yml
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
name: npm test and release
on:
push:
branches:
- main
- release/*
tags:
- 'v*'
workflow_dispatch:
env:
REGISTRY: ghcr.io
jobs:
test:
strategy:
matrix:
os: [windows, macos, ubuntu]
node-version: [20, 21]
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install-ci-test
npm-publish:
if: startsWith(github.ref, 'refs/tags/')
needs: test
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 21.x
registry-url: https://registry.npmjs.org/
- run: npm ci && npm publish --access=public --@cyclonedx:registry='https://registry.npmjs.org'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}