Skip to content

Commit fea0641

Browse files
committed
forgot the yml file to build
1 parent 473127c commit fea0641

1 file changed

Lines changed: 79 additions & 0 deletions

File tree

.github/workflows/hugo.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Build and Deploy Hugo Site
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
permissions:
10+
contents: write
11+
pages: write
12+
id-token: write
13+
14+
jobs:
15+
build-and-deploy:
16+
runs-on: ubuntu-latest
17+
env:
18+
HUGO_VERSION: 0.121.0
19+
steps:
20+
- name: Install Hugo CLI
21+
run: |
22+
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
23+
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
24+
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
with:
28+
submodules: recursive
29+
fetch-depth: 0
30+
31+
- name: Setup Node.js
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: '18'
35+
36+
- name: Install Node dependencies
37+
run: |
38+
if [ -f package.json ]; then
39+
npm install
40+
fi
41+
42+
- name: Update community stats (optional)
43+
run: |
44+
if [ -f .github/scripts/fetch-discourse-activity.js ]; then
45+
node .github/scripts/fetch-discourse-activity.js || echo "Community stats update failed, continuing..."
46+
fi
47+
48+
- name: Build with Hugo
49+
env:
50+
HUGO_ENVIRONMENT: production
51+
HUGO_ENV: production
52+
run: |
53+
# Clean docs directory
54+
rm -rf docs
55+
56+
# Build Hugo site to docs directory
57+
hugo \
58+
--gc \
59+
--minify \
60+
--destination docs \
61+
--baseURL "https://powershellorg.github.io/PowerShellOrgWebsite/"
62+
63+
- name: Add .nojekyll file
64+
run: touch docs/.nojekyll
65+
66+
- name: Commit and push to main
67+
run: |
68+
git config --local user.email "action@github.com"
69+
git config --local user.name "GitHub Action"
70+
git add docs/
71+
git add data/ || true
72+
73+
# Only commit if there are changes
74+
if ! git diff --staged --quiet; then
75+
git commit -m "Deploy Hugo site to docs/ [skip ci]"
76+
git push
77+
else
78+
echo "No changes to commit"
79+
fi

0 commit comments

Comments
 (0)