20
20
- name : Setup Node.js
21
21
uses : actions/setup-node@v4
22
22
with :
23
- node-version : 20
23
+ node-version : 22
24
24
cache : ' npm'
25
25
26
26
- name : Install dependencies
@@ -32,12 +32,35 @@ jobs:
32
32
- name : TypeScript type checking
33
33
run : npm run typecheck
34
34
35
+ security :
36
+ name : Security Audit
37
+ runs-on : ubuntu-latest
38
+ steps :
39
+ - name : Checkout repository
40
+ uses : actions/checkout@v4
41
+
42
+ - name : Setup Node.js
43
+ uses : actions/setup-node@v4
44
+ with :
45
+ node-version : 22
46
+ cache : ' npm'
47
+
48
+ - name : Install dependencies
49
+ run : npm ci
50
+
51
+ - name : Run security audit
52
+ run : npm audit --audit-level moderate
53
+
54
+ - name : Check for known vulnerabilities
55
+ run : npm audit --audit-level high --production
56
+
35
57
test :
36
58
name : Test
37
- runs-on : ubuntu-latest
59
+ runs-on : ${{ matrix.os }}
38
60
strategy :
39
61
matrix :
40
- node-version : [22.x]
62
+ os : [ubuntu-latest, windows-latest, macos-latest]
63
+ node-version : [20.x, 22.x, 24.x]
41
64
42
65
steps :
43
66
- name : Checkout repository
@@ -57,23 +80,23 @@ jobs:
57
80
58
81
- name : Upload coverage reports
59
82
uses : codecov/codecov-action@v4
60
- if : matrix.node-version == '20.x ' && github.event_name != 'pull_request'
83
+ if : matrix.node-version == '22.x' && matrix.os == 'ubuntu-latest ' && github.event_name != 'pull_request'
61
84
with :
62
85
token : ${{ secrets.CODECOV_TOKEN }}
63
86
fail_ci_if_error : false
64
87
65
88
build :
66
89
name : Build
67
90
runs-on : ubuntu-latest
68
- needs : [lint-and-typecheck, test]
91
+ needs : [lint-and-typecheck, test, security ]
69
92
steps :
70
93
- name : Checkout repository
71
94
uses : actions/checkout@v4
72
95
73
96
- name : Setup Node.js
74
97
uses : actions/setup-node@v4
75
98
with :
76
- node-version : 20
99
+ node-version : 22
77
100
cache : ' npm'
78
101
79
102
- name : Install dependencies
@@ -93,8 +116,11 @@ jobs:
93
116
name : Publish to npm
94
117
runs-on : ubuntu-latest
95
118
needs : build
96
- if : github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') )
119
+ if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
97
120
environment : npm-publish
121
+ permissions :
122
+ contents : read
123
+ id-token : write
98
124
steps :
99
125
- name : Checkout repository
100
126
uses : actions/checkout@v4
@@ -104,8 +130,9 @@ jobs:
104
130
- name : Setup Node.js
105
131
uses : actions/setup-node@v4
106
132
with :
107
- node-version : 20
133
+ node-version : 22
108
134
registry-url : ' https://registry.npmjs.org'
135
+ cache : ' npm'
109
136
110
137
- name : Download build artifact
111
138
uses : actions/download-artifact@v4
@@ -114,10 +141,12 @@ jobs:
114
141
path : dist/
115
142
116
143
- name : Install dependencies
117
- run : npm ci
144
+ run : npm ci --only=production
145
+
146
+ - name : Verify package contents
147
+ run : npm pack --dry-run
118
148
119
149
- name : Publish to NPM
120
- if : startsWith(github.ref, 'refs/tags/v')
121
- run : npm publish --access public
150
+ run : npm publish --access public --provenance
122
151
env :
123
152
NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
0 commit comments