-
Notifications
You must be signed in to change notification settings - Fork 0
180 lines (164 loc) · 5.35 KB
/
hugo.yaml
File metadata and controls
180 lines (164 loc) · 5.35 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# Workflow referenced from: https://gohugo.io/host-and-deploy/host-on-github-pages/
name: Deploy Hugo site to Pages
on:
push:
branches:
- main
- update-workflow
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
defaults:
run:
shell: bash
working-directory: ./marketing
jobs:
# --------------------------------------------------
# 1️⃣ Build
# --------------------------------------------------
build:
runs-on: ubuntu-latest
env:
DART_SASS_VERSION: 1.93.2
GO_VERSION: 1.25.3
HUGO_VERSION: 0.152.2
NODE_VERSION: 22.20.0
TZ: America/Toronto
steps:
- name: Checkout
uses: actions/checkout@v5
with:
submodules: recursive
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Create directory for user-specific executable files
run: |
mkdir -p "${HOME}/.local"
- name: Install Dart Sass
run: |
curl -sLJO "https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz"
tar -C "${HOME}/.local" -xf "dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz"
rm "dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz"
echo "${HOME}/.local/dart-sass" >> "${GITHUB_PATH}"
- name: Install Hugo
run: |
curl -sLJO "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
mkdir "${HOME}/.local/hugo"
tar -C "${HOME}/.local/hugo" -xf "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
rm "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
echo "${HOME}/.local/hugo" >> "${GITHUB_PATH}"
- name: Verify installations
run: |
echo "Dart Sass: $(sass --version)"
echo "Go: $(go version)"
echo "Hugo: $(hugo version)"
echo "Node.js: $(node --version)"
- name: Install Node.js dependencies
run: |
[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true
- name: Configure Git
run: |
git config core.quotepath false
- name: Cache restore
id: cache-restore
uses: actions/cache/restore@v4
with:
path: ${{ runner.temp }}/hugo_cache
key: hugo-${{ github.run_id }}
restore-keys:
hugo-
- name: Build the site
run: |
hugo \
--gc \
--minify \
--baseURL "${{ steps.pages.outputs.base_url }}/" \
--cacheDir "${{ runner.temp }}/hugo_cache"
- name: Cache save
id: cache-save
uses: actions/cache/save@v4
with:
path: ${{ runner.temp }}/hugo_cache
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
name: build-output
path: ./marketing/public
# --------------------------------------------------
# 2️⃣ Deploy
# --------------------------------------------------
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
# --------------------------------------------------
# 3️⃣ Generate SBOM
# --------------------------------------------------
generate-sbom:
name: 📦 Generate SBOM
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout Repo
uses: actions/checkout@v5
- name: Download Build Artifacts
uses: actions/download-artifact@v6
with:
name: build-output
path: ./marketing
- name: Generate CycloneDX SBOM
run: npx @cyclonedx/cyclonedx-npm --output-format JSON --output-file shiftleftcyber.github.io.cdx.json
- name: Upload SBOM
uses: actions/upload-artifact@v5
with:
name: generated-sbom
path: ./marketing/shiftleftcyber.github.io.cdx.json
# --------------------------------------------------
# 4️⃣ Sign SBOM
# --------------------------------------------------
sign-sbom:
name: 🔏 Sign SBOM
runs-on: ubuntu-latest
needs: generate-sbom
steps:
- name: Checkout Repo
uses: actions/checkout@v5
- name: Download Generated SBOM
uses: actions/download-artifact@v6
with:
name: generated-sbom
- name: Sign SBOM
uses: shiftleftcyber/secure-sbom-action@v1.3.1
with:
sbom_file: shiftleftcyber.github.io.cdx.json
secure_sbom_action: sign
api_key: ${{ secrets.SECURE_SBOM_API_KEY }}
key_id: ${{ secrets.SECURE_SBOM_KEYID }}
- name: Upload Signed SBOM
uses: actions/upload-artifact@v5
with:
name: signed-sbom
path: ./marketing/shiftleftcyber.github.io.cdx.signed.json