Skip to content

Commit 952952f

Browse files
authored
Merge branch 'master' into docs/pin-model-to-dock
2 parents fdf54ac + 540f007 commit 952952f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+22205
-32012
lines changed
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Build and Preview Docs
2+
3+
on:
4+
pull_request_target:
5+
branches: [master]
6+
types: [opened, synchronize, reopened, closed]
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
concurrency:
13+
group: preview-${{ github.event.pull_request.number || github.run_id }}
14+
cancel-in-progress: true
15+
16+
defaults:
17+
run:
18+
shell: bash
19+
20+
jobs:
21+
build-and-deploy-preview:
22+
runs-on: ubuntu-24.04
23+
env:
24+
HUGO_VERSION: 0.158.0
25+
26+
steps:
27+
- name: Checkout PR code
28+
if: github.event.action != 'closed'
29+
uses: actions/checkout@v6
30+
with:
31+
repository: ${{ github.event.pull_request.head.repo.full_name }}
32+
ref: ${{ github.event.pull_request.head.sha }}
33+
persist-credentials: false
34+
submodules: recursive
35+
fetch-depth: 0
36+
37+
- name: Checkout for cleanup
38+
if: github.event.action == 'closed'
39+
uses: actions/checkout@v6
40+
with:
41+
ref: gh-pages
42+
fetch-depth: 0
43+
44+
- name: Install Hugo CLI
45+
if: github.event.action != 'closed'
46+
run: |
47+
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
48+
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
49+
50+
- name: Install Dart Sass
51+
if: github.event.action != 'closed'
52+
run: sudo snap install dart-sass
53+
54+
- name: Setup Node
55+
if: github.event.action != 'closed'
56+
uses: actions/setup-node@v4
57+
with:
58+
node-version: "20"
59+
60+
- name: Install dependencies
61+
if: github.event.action != 'closed'
62+
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
63+
64+
- name: Build PR preview
65+
if: github.event.action != 'closed'
66+
env:
67+
HUGO_ENVIRONMENT: production
68+
HUGO_ENV: production
69+
HUGO_PREVIEW: "true"
70+
run: |
71+
hugo \
72+
--gc \
73+
--minify \
74+
--baseURL "/"
75+
cat > public/robots.txt <<'EOF'
76+
User-agent: *
77+
Disallow: /
78+
EOF
79+
80+
- name: Deploy PR preview
81+
if: github.event.action != 'closed'
82+
uses: rossjrw/pr-preview-action@v1.6.3
83+
with:
84+
source-dir: ./public
85+
preview-branch: gh-pages
86+
umbrella-dir: pr-preview
87+
action: auto
88+
comment: false
89+
90+
- name: Comment PR with Preview URL
91+
if: github.event.action != 'closed'
92+
uses: marocchino/sticky-pull-request-comment@v2
93+
with:
94+
header: pr-preview
95+
message: |
96+
🚀 **Preview deployment for PR #${{ github.event.pull_request.number }}**
97+
98+
🌐 **Preview URL**: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/pr-preview/pr-${{ github.event.pull_request.number }}/
99+
100+
_This preview will be updated automatically when you push new commits to this PR._
101+
- name: Cleanup PR preview on close
102+
if: github.event.action == 'closed'
103+
uses: rossjrw/pr-preview-action@v1.6.3
104+
with:
105+
preview-branch: gh-pages
106+
umbrella-dir: pr-preview
107+
action: remove

.github/workflows/hugo.yaml

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,23 @@ on:
1212
# Allows you to run this workflow manually from the Actions tab
1313
workflow_dispatch:
1414

15-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
1615
permissions:
17-
contents: read
18-
pages: write
19-
id-token: write
16+
contents: write
2017

2118
concurrency:
22-
group: "pages-deployment"
23-
cancel-in-progress: true # Only latest deployment runs
19+
group: pages-deployment
20+
cancel-in-progress: true
2421

2522
# Default to bash
2623
defaults:
2724
run:
2825
shell: bash
2926

3027
jobs:
31-
# Build job
32-
build:
28+
deploy:
3329
runs-on: ubuntu-24.04
3430
env:
35-
HUGO_VERSION: 0.157.0
31+
HUGO_VERSION: 0.158.0
3632
steps:
3733
- name: Install Hugo CLI
3834
run: |
@@ -45,34 +41,27 @@ jobs:
4541
with:
4642
submodules: recursive
4743
fetch-depth: 0
48-
- name: Setup Pages
49-
id: pages
50-
uses: actions/configure-pages@v5
44+
- name: Setup Node
45+
uses: actions/setup-node@v4
46+
with:
47+
node-version: "20"
5148
- name: Install Node.js dependencies
5249
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
5350
- name: Build with Hugo
5451
env:
55-
# For maximum backward compatibility with Hugo modules
5652
HUGO_ENVIRONMENT: production
5753
HUGO_ENV: production
5854
run: |
5955
hugo \
6056
--gc \
6157
--minify \
62-
--baseURL "${{ steps.pages.outputs.base_url }}/"
63-
- name: Upload artifact
64-
uses: actions/upload-pages-artifact@v3
65-
with:
66-
path: ./public
67-
68-
# Deployment job
69-
deploy:
70-
environment:
71-
name: github-pages
72-
url: ${{ steps.deployment.outputs.page_url }}
73-
runs-on: ubuntu-24.04
74-
needs: build
75-
steps:
58+
--baseURL "/"
59+
cp CNAME public/CNAME
60+
touch public/.nojekyll
7661
- name: Deploy to GitHub Pages
77-
id: deployment
78-
uses: actions/deploy-pages@v4
62+
uses: peaceiris/actions-gh-pages@v4
63+
with:
64+
github_token: ${{ secrets.GITHUB_TOKEN }}
65+
publish_dir: ./public
66+
publish_branch: gh-pages
67+
keep_files: true

Makefile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ setup:
2222
## Run docs.layer5.io on your local machine with draft and future content enabled.
2323
site: check-go
2424
hugo server -D -F
25-
26-
## Run docs.layer5.io on your local machine. Alternate method.
27-
site-fast:
28-
gatsby develop
2925

3026
## Build docs.layer5.io on your local machine.
3127
build:
@@ -36,7 +32,7 @@ clean:
3632
hugo --cleanDestinationDir
3733
make site
3834

39-
.PHONY: setup build site clean site-fast check-go docker
35+
.PHONY: setup build site clean check-go docker
4036

4137
check-go:
4238
@echo "Checking if Go is installed..."

0 commit comments

Comments
 (0)