-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (83 loc) · 2.49 KB
/
pipeline.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
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
name: Pipeline
on:
# Run on any branch receiving a push
push:
# Allow manual trigger of the workflow
workflow_dispatch:
jobs:
# Talisman Secrets Check
talisman-check:
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Detect secrets in incoming commits with Talisman
uses: digitalservicebund/talisman-secrets-scan-action@9a4cb85589e29a62b4546eb566119753a5680aeb
# Trivy Vulnerability Scan
trivy-scan:
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write # upload-sarif
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run Trivy vulnerability scanner in repo mode
uses: aquasecurity/trivy-action@d9cd5b1c23aaf8cb31bb09141028215828364bbb
with:
scan-type: "fs"
format: "sarif"
output: "trivy-results.sarif"
severity: "CRITICAL,HIGH"
- name: Verify SARIF file exists
run: ls -la trivy-results.sarif
- name: Check trivy results
run: |
if grep -qE 'HIGH|CRITICAL' trivy-results.sarif; then
echo "Vulnerabilities found"
exit 1
else
echo "No significant vulnerabilities found"
exit 0
fi
- name: Upload Trivy scan results to GitHub Security tab
if: ${{ always() && github.ref == 'refs/heads/main' }}
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: "trivy-results.sarif"
# Deploy Storybook to GitHub Pages
build-and-deploy-storybook:
if: ${{ github.ref == 'refs/heads/main' }}
needs:
- talisman-check
- trivy-scan
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "20"
- name: Install dependencies
run: npm ci
- name: Build Storybook
run: npm run build:storybook
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Upload Storybook artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./storybook-static
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1