-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (53 loc) · 1.74 KB
/
Copy pathrelease-security.yml
File metadata and controls
55 lines (53 loc) · 1.74 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
name: Release Security
on:
push:
tags:
- 'v*.*.*'
jobs:
supply-chain:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
packages: write
attestations: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Generate SBOM (CycloneDX)
uses: CycloneDX/gh-node-module-generatebom@v1
with:
path: .
output: sbom.cdx.json
- name: Upload SBOM artifact
uses: actions/upload-artifact@v4
with:
name: sbom
path: sbom.cdx.json
- name: Build container
run: docker build -f apps/collector/Dockerfile -t ghcr.io/${{ github.repository }}/collector:${{ github.ref_name }} .
- name: Trivy scan image
uses: aquasecurity/trivy-action@0.28.0
with:
image-ref: ghcr.io/${{ github.repository }}/collector:${{ github.ref_name }}
severity: CRITICAL,HIGH
exit-code: '1'
- name: Login GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push image
run: docker push ghcr.io/${{ github.repository }}/collector:${{ github.ref_name }}
- name: Install cosign
uses: sigstore/cosign-installer@v3.7.0
- name: Sign image with Cosign keyless
run: cosign sign --yes ghcr.io/${{ github.repository }}/collector:${{ github.ref_name }}
- name: Attest build provenance
uses: actions/attest-build-provenance@v1
with:
subject-name: ghcr.io/${{ github.repository }}/collector
subject-digest: sha256:${{ github.sha }}