Repository navigation
136 lines (115 loc) · 4.01 KB
/
Copy pathrelease.yml
File metadata and controls
136 lines (115 loc) · 4.01 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Release & Dual-Publish CI
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions: read-all
jobs:
test-matrix:
name: Test Matrix (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
matrix:
node-version: [20, 22, 24]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install pnpm
uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
with:
version: 9
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run Test Suite
run: pnpm test
build-and-attest:
name: Build, SLSA Provenance & SBOM
needs: [test-matrix]
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
attestations: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install pnpm
uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
with:
version: 9
- name: Setup Node.js 22
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 22
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build Package
run: pnpm run build
- name: Generate SLSA Build Provenance Attestation
uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
with:
subject-path: 'dist/**'
- name: Generate CycloneDX SBOM
uses: anchore/sbom-action@dfcb83b97731532d72be422cbc51ee64adb6fd56 # v0.24.4
with:
path: ./
format: 'cyclonedx-json'
output-file: 'dist/agentshield-cyclonedx.sbom.json'
artifact-name: 'agentshield-cyclonedx.sbom.json'
upload-artifact: true
upload-release-assets: false
- name: Generate SPDX SBOM
uses: anchore/sbom-action@dfcb83b97731532d72be422cbc51ee64adb6fd56 # v0.24.4
with:
path: ./
format: 'spdx-json'
output-file: 'dist/agentshield-spdx.sbom.json'
artifact-name: 'agentshield-spdx.sbom.json'
upload-artifact: true
upload-release-assets: false
- name: Upload Build & SBOM Artifacts
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: dist-artifacts
path: dist/
retention-days: 30
dual-publish:
name: Dual-Publish to npm & GitHub Packages
needs: [build-and-attest]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
attestations: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Node.js 22
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 22
registry-url: 'https://registry.npmjs.org'
- name: Download Build Artifacts
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: dist-artifacts
path: dist/
- name: Publish to public npm Registry with Sigstore Provenance
run: npm publish --access public --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Reconfigure for GitHub Packages
run: |
echo "@ritualdev-lab:registry=https://npm.pkg.github.com" > .npmrc
echo "//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}" >> .npmrc
npm publish --provenance=false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}