Skip to content

Commit 4e0f99c

Browse files
Copilotchefgs
andauthored
Add Hugo branch preview workflow
Agent-Logs-Url: https://github.com/cloudengine-labs/devops_os/sessions/da764e3f-6ccf-4173-87cc-3bff9ee56e38 Co-authored-by: chefgs <7605658+chefgs@users.noreply.github.com>
1 parent 9c56138 commit 4e0f99c

4 files changed

Lines changed: 136 additions & 1 deletion

File tree

.github/workflows/hugo-preview.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Build Hugo Preview
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- main
7+
paths:
8+
- ".github/workflows/pages.yml"
9+
- ".github/workflows/hugo-preview.yml"
10+
- "hugo-docs/**"
11+
- "feature-announcements/**"
12+
pull_request:
13+
branches:
14+
- main
15+
paths:
16+
- ".github/workflows/pages.yml"
17+
- ".github/workflows/hugo-preview.yml"
18+
- "hugo-docs/**"
19+
- "feature-announcements/**"
20+
workflow_dispatch:
21+
22+
permissions:
23+
contents: read
24+
25+
concurrency:
26+
group: "hugo-preview-${{ github.ref }}"
27+
cancel-in-progress: true
28+
29+
defaults:
30+
run:
31+
shell: bash
32+
33+
jobs:
34+
build-preview:
35+
runs-on: ubuntu-latest
36+
env:
37+
HUGO_VERSION: "0.158.0"
38+
PREVIEW_BASEURL: "http://127.0.0.1:1313/"
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v4
42+
with:
43+
fetch-depth: 0
44+
45+
- name: Setup Go
46+
uses: actions/setup-go@v5
47+
with:
48+
go-version: "1.22"
49+
50+
- name: Install Hugo CLI
51+
run: |
52+
wget -O "${{ runner.temp }}/hugo.deb" \
53+
"https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb"
54+
sudo dpkg -i "${{ runner.temp }}/hugo.deb"
55+
56+
- name: Download Hugo modules
57+
working-directory: ./hugo-docs
58+
run: hugo mod tidy
59+
60+
- name: Build Hugo preview site
61+
working-directory: ./hugo-docs
62+
env:
63+
HUGO_ENVIRONMENT: production
64+
HUGO_BASEURL: ${{ env.PREVIEW_BASEURL }}
65+
run: hugo --gc --minify
66+
67+
- name: Upload Hugo preview artifact
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: hugo-preview-${{ github.run_number }}
71+
path: ./hugo-docs/public
72+
if-no-files-found: error
73+
retention-days: 7
74+
75+
- name: Publish preview instructions
76+
run: |
77+
{
78+
echo "## Hugo branch preview"
79+
echo
80+
echo "Artifact: \`hugo-preview-${{ github.run_number }}\`"
81+
echo
82+
echo "After downloading the artifact, serve the extracted \`public/\` directory locally:"
83+
echo
84+
echo "\`\`\`bash"
85+
echo "python -m http.server 1313 -d public"
86+
echo "\`\`\`"
87+
echo
88+
echo "Then verify:"
89+
echo
90+
echo "- http://127.0.0.1:1313/docs/talks/chennai-foss-2026/"
91+
echo "- http://127.0.0.1:1313/feature-announcements/chennai-foss-2026/idp-onboarding-demo.html"
92+
echo
93+
echo "For a one-off hosted check, you can still run the production Pages workflow manually on this branch, but that deploys to the shared GitHub Pages environment."
94+
} >> "$GITHUB_STEP_SUMMARY"

.github/workflows/pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
build:
2525
runs-on: ubuntu-latest
2626
env:
27-
HUGO_VERSION: "0.147.0"
27+
HUGO_VERSION: "0.158.0"
2828
steps:
2929
- name: Checkout repository
3030
uses: actions/checkout@v4

CONTRIBUTING.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ Please be respectful and constructive in all interactions. We are committed to p
3232
```bash
3333
python -m pytest cli/test_cli.py mcp_server/test_server.py tests/test_comprehensive.py -v
3434
```
35+
4. If your change touches the Hugo docs or the Chennai FOSS demo pages, preview them from your branch before opening a PR:
36+
```bash
37+
cd /home/runner/work/devops_os/devops_os/hugo-docs
38+
hugo mod tidy
39+
hugo server --bind 0.0.0.0 --baseURL http://localhost:1313/
40+
```
41+
Verify:
42+
- `http://localhost:1313/docs/talks/chennai-foss-2026/`
43+
- `http://localhost:1313/feature-announcements/chennai-foss-2026/idp-onboarding-demo.html`
44+
You can also run the **Build Hugo Preview** workflow to get a downloadable preview artifact without deploying to the production Pages site.
3545

3646
---
3747

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,37 @@ You can also customize `.devcontainer/devcontainer.env.json` directly to enable
399399

400400
---
401401

402+
## 🌐 Hugo branch preview
403+
404+
The production GitHub Pages site is still deployed only from `main`, but you can test the Hugo-hosted Chennai FOSS IDP UI from your current branch in two safe ways.
405+
406+
### Local preview
407+
408+
```bash
409+
cd /home/runner/work/devops_os/devops_os/hugo-docs
410+
hugo mod tidy
411+
hugo server --bind 0.0.0.0 --baseURL http://localhost:1313/
412+
```
413+
414+
Then verify:
415+
416+
- `http://localhost:1313/docs/talks/chennai-foss-2026/`
417+
- `http://localhost:1313/feature-announcements/chennai-foss-2026/idp-onboarding-demo.html`
418+
419+
### GitHub Actions preview artifact
420+
421+
Use the **Build Hugo Preview** workflow on your branch. It builds the Hugo site without deploying to the shared GitHub Pages environment and uploads the generated `public/` directory as an artifact.
422+
423+
After downloading the artifact, serve it locally:
424+
425+
```bash
426+
python -m http.server 1313 -d public
427+
```
428+
429+
For a one-off hosted verification, you can still manually run **Deploy Hugo Documentation** on your branch with `workflow_dispatch`, but that updates the shared Pages site.
430+
431+
---
432+
402433
## 🤝 Contributing
403434

404435
Contributions are welcome! Whether it's a bug fix, a new scaffold generator, or documentation improvement — feel free to open an issue or submit a pull request.

0 commit comments

Comments
 (0)