Skip to content

Commit 17feedf

Browse files
authored
Create page.yml
1 parent bb0c962 commit 17feedf

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

.github/workflows/page.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Generate and Deploy GitHub Pages
2+
3+
on:
4+
# Run once hourly
5+
schedule:
6+
- cron: '0 * * * *'
7+
# Allow manual trigger
8+
workflow_dispatch:
9+
# Run on pushes to main branch
10+
push:
11+
branches:
12+
- main
13+
14+
jobs:
15+
build-and-deploy:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: write
19+
steps:
20+
- name: Checkout Repository
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0 # Fetch all history for proper repo data
24+
25+
- name: Set up Go
26+
uses: actions/setup-go@v5
27+
with:
28+
go-version: '1.24.x'
29+
cache: true
30+
31+
- name: Build Site Generator
32+
run: |
33+
go install github.com/go-i2p/go-gh-page/cmd/github-site-gen@latest
34+
export GOBIN=$(go env GOPATH)/bin
35+
cp -v "$GOBIN/github-site-gen" ./github-site-gen
36+
# Ensure the binary is executable
37+
chmod +x github-site-gen
38+
39+
- name: Generate Site
40+
run: |
41+
# Determine current repository owner and name
42+
REPO_OWNER=$(echo $GITHUB_REPOSITORY | cut -d '/' -f 1)
43+
REPO_NAME=$(echo $GITHUB_REPOSITORY | cut -d '/' -f 2)
44+
45+
# Generate the site
46+
./github-site-gen -repo "${REPO_OWNER}/${REPO_NAME}" -output ./site
47+
48+
# Create a .nojekyll file to disable Jekyll processing
49+
touch ./site/.nojekyll
50+
51+
# Add a .gitattributes file to ensure consistent line endings
52+
echo "* text=auto" > ./site/.gitattributes
53+
54+
- name: Deploy to GitHub Pages
55+
uses: JamesIves/github-pages-deploy-action@v4
56+
with:
57+
folder: site # The folder the action should deploy
58+
branch: gh-pages # The branch the action should deploy to
59+
clean: true # Automatically remove deleted files from the deploy branch
60+
commit-message: "Deploy site generated on ${{ github.sha }}"

0 commit comments

Comments
 (0)