Skip to content

Commit 440cee5

Browse files
committed
Add standalone website build workflow (#7342)
Extract website build into a separate GitHub Actions workflow that does not depend on the build-image container. This is Phase 1: both the new workflow and the existing build job produce website artifacts in parallel for comparison. The deploy job is disabled (false condition) until Phase 2 when we remove the website build from test-build-deploy.yml. Signed-off-by: Friedrich Gonzalez <1517449+friedrichg@users.noreply.github.com>
1 parent 20111ba commit 440cee5

2 files changed

Lines changed: 937 additions & 372 deletions

File tree

.github/workflows/web.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: website
2+
permissions: read-all
3+
on:
4+
push:
5+
branches: [master]
6+
paths:
7+
- 'docs/**'
8+
- 'website/**'
9+
- 'tools/website/**'
10+
- 'CHANGELOG.md'
11+
- 'GOVERNANCE.md'
12+
- 'MAINTAINERS.md'
13+
- 'README.md'
14+
- 'code-of-conduct.md'
15+
- '.github/workflows/web.yml'
16+
pull_request:
17+
paths:
18+
- 'docs/**'
19+
- 'website/**'
20+
- 'tools/website/**'
21+
- 'CHANGELOG.md'
22+
- 'GOVERNANCE.md'
23+
- 'MAINTAINERS.md'
24+
- 'README.md'
25+
- 'code-of-conduct.md'
26+
- '.github/workflows/web.yml'
27+
28+
jobs:
29+
build_website:
30+
runs-on: ubuntu-24.04
31+
env:
32+
HUGO_VERSION: "0.101.0"
33+
NODE_VERSION: "18"
34+
steps:
35+
- name: Checkout Repo
36+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
37+
with:
38+
submodules: recursive
39+
- name: Setup Go
40+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
41+
with:
42+
go-version-file: go.mod
43+
cache: false
44+
- name: Setup Node.js
45+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
46+
with:
47+
node-version: ${{ env.NODE_VERSION }}
48+
- name: Install Hugo
49+
run: |
50+
curl -sLJO "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz"
51+
mkdir -p "${HOME}/.local/hugo"
52+
tar -C "${HOME}/.local/hugo" -xf "hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz"
53+
rm "hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz"
54+
echo "${HOME}/.local/hugo" >> "${GITHUB_PATH}"
55+
- name: Install Node.js dependencies
56+
working-directory: website
57+
run: npm ci
58+
- name: Build Website
59+
run: |
60+
./tools/website/web-pre.sh
61+
cd website && HUGO_ENV=production hugo --config config.toml --minify -v
62+
- name: Upload Website Artifact
63+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
64+
with:
65+
name: website public standalone
66+
path: website/public/
67+
68+
deploy_website:
69+
needs: [build_website]
70+
if: false && github.ref == 'refs/heads/master' && github.repository == 'cortexproject/cortex'
71+
runs-on: ubuntu-24.04
72+
permissions:
73+
contents: write
74+
steps:
75+
- name: Checkout Repo
76+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
77+
with:
78+
ssh-key: ${{ secrets.WEBSITE_DEPLOY_SSH_PRIVATE_KEY }}
79+
- name: Download Website Artifact
80+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
81+
with:
82+
name: website public standalone
83+
path: website/public
84+
- name: Setup SSH Keys
85+
run: |
86+
mkdir -p ~/.ssh
87+
ssh-keyscan github.com >> ~/.ssh/known_hosts
88+
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
89+
ssh-add - <<< "${{ secrets.WEBSITE_DEPLOY_SSH_PRIVATE_KEY }}"
90+
env:
91+
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
92+
shell: bash
93+
- name: Deploy Website
94+
run: ./tools/website/web-deploy.sh
95+
env:
96+
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
97+
GIT_SSH_COMMAND: "ssh -o StrictHostKeyChecking=no"

0 commit comments

Comments
 (0)