Repository navigation
120 lines (100 loc) · 3.38 KB
/
Copy pathrelease.yml
File metadata and controls
120 lines (100 loc) · 3.38 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
name: Release & Publish
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions: read-all
jobs:
build:
name: Build & Test
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout Code
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 TypeScript
run: pnpm run build
- name: Check Code Quality
run: pnpm run check
- name: Run Test Suite
run: pnpm test
publish:
name: Publish to npm & GitHub Releases
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
attestations: write
steps:
- name: Checkout Code
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"
registry-url: "https://registry.npmjs.org"
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Build TypeScript
run: pnpm run build
- name: Pack Release Tarball
run: |
mkdir -p release-artifacts sboms
pnpm pack --pack-destination release-artifacts
- name: Generate SLSA Build Provenance Attestation
uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
with:
subject-path: 'release-artifacts/*.tgz'
- name: Generate CycloneDX SBOM
uses: anchore/sbom-action@dfcb83b97731532d72be422cbc51ee64adb6fd56 # v0.24.4
with:
path: ./
format: 'cyclonedx-json'
output-file: 'sboms/dbshield-cyclonedx.sbom.json'
artifact-name: 'dbshield-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: 'sboms/dbshield-spdx.sbom.json'
artifact-name: 'dbshield-spdx.sbom.json'
upload-artifact: true
upload-release-assets: false
- name: Create GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@c95fe1489396fe8a9ec87454c605fbb0b60764ab # v2.2.1
with:
files: |
release-artifacts/*.tgz
sboms/*.sbom.json
generate_release_notes: true
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to npm with Provenance
run: npm publish release-artifacts/*.tgz --access public --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}