mirror of
https://github.com/go-i2p/go-gh-page.git
synced 2025-06-07 18:24:28 -04:00
gitignore, action
This commit is contained in:
60
.github/workflows/page.yml
vendored
Normal file
60
.github/workflows/page.yml
vendored
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
name: Generate and Deploy GitHub Pages
|
||||||
|
|
||||||
|
on:
|
||||||
|
# Run once hourly
|
||||||
|
schedule:
|
||||||
|
- cron: '0 * * * *'
|
||||||
|
# Allow manual trigger
|
||||||
|
workflow_dispatch:
|
||||||
|
# Run on pushes to main branch
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0 # Fetch all history for proper repo data
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: '1.24.x'
|
||||||
|
cache: true
|
||||||
|
|
||||||
|
- name: Build Site Generator
|
||||||
|
run: |
|
||||||
|
go build -o github-site-gen ./cmd/github-site-gen/main.go
|
||||||
|
chmod +x github-site-gen
|
||||||
|
|
||||||
|
- name: Generate Site
|
||||||
|
run: |
|
||||||
|
# Determine current repository owner and name
|
||||||
|
REPO_OWNER=$(echo $GITHUB_REPOSITORY | cut -d '/' -f 1)
|
||||||
|
REPO_NAME=$(echo $GITHUB_REPOSITORY | cut -d '/' -f 2)
|
||||||
|
|
||||||
|
# Generate the site
|
||||||
|
./github-site-gen -repo "${REPO_OWNER}/${REPO_NAME}" -output ./site
|
||||||
|
|
||||||
|
# Create a .nojekyll file to disable Jekyll processing
|
||||||
|
touch ./site/.nojekyll
|
||||||
|
|
||||||
|
# Add a .gitattributes file to ensure consistent line endings
|
||||||
|
echo "* text=auto" > ./site/.gitattributes
|
||||||
|
|
||||||
|
# Copy the style.css to the root of the site
|
||||||
|
cp ./pkg/templates/style.css ./site/style.css
|
||||||
|
|
||||||
|
- name: Deploy to GitHub Pages
|
||||||
|
uses: JamesIves/github-pages-deploy-action@v4
|
||||||
|
with:
|
||||||
|
folder: site # The folder the action should deploy
|
||||||
|
branch: gh-pages # The branch the action should deploy to
|
||||||
|
clean: true # Automatically remove deleted files from the deploy branch
|
||||||
|
commit-message: "Deploy site generated on ${{ github.sha }}"
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -23,3 +23,4 @@ go.work.sum
|
|||||||
|
|
||||||
# env file
|
# env file
|
||||||
.env
|
.env
|
||||||
|
output
|
Reference in New Issue
Block a user