add workflow
Some checks failed
Build and Push Static files / deploy (push) Failing after 59s

This commit is contained in:
Jay
2026-03-03 14:52:27 +00:00
parent 4ba1f4be21
commit 1209e30858
2 changed files with 38 additions and 53 deletions

View File

@@ -1,61 +1,43 @@
name: Build Notes Site
name: Build and Push Static files
on:
push:
branches: [ main ]
branches:
- main # Trigger on pushes to your default branch
jobs:
build:
deploy:
runs-on: ubuntu-latest
container:
image: node:20-bookworm # Node for checkout
steps:
# 1⃣ Checkout repository
- uses: actions/checkout@v4
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
# 2⃣ Install Python for MkDocs build
- name: Install Python
- name: Build Docker Image
run: docker build -t mkdocs-builder -f ci/mkdocs/Dockerfile .
- name: Build Static Site
run: |
apt-get update
apt-get install -y python3 python3-venv python3-pip
docker run --rm -v $(pwd):/docs mkdocs-builder build
# 3⃣ List repo files (debug)
- name: List repo files
run: ls -R "${{ github.workspace }}"
# 4⃣ Build MkDocs site locally
- name: Build MkDocs site
- name: Deploy to Branch
run: |
python3 -m venv .venv
.venv/bin/pip install --upgrade pip
.venv/bin/pip install -r ci/mkdocs/requirements.txt
.venv/bin/mkdocs build --clean --site-dir site_output
# 5⃣ Install Docker CLI so we can copy to volume
- name: Install Docker CLI
run: |
apt-get update
apt-get install -y ca-certificates curl gnupg lsb-release
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
https://download.docker.com/linux/debian $(lsb_release -cs) stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get install -y docker-ce-cli
# 6⃣ Copy the site output into notes_public Docker volume
- name: Copy site to notes_public volume
run: |
docker run --rm \
-v notes_public:/public \
-v "${{ github.workspace }}/site_output:/tmp/site" \
alpine sh -c "cp -r /tmp/site/* /public/"
# 7⃣ Optional: Verify files in volume
- name: List notes_public volume
run: |
docker run --rm -v notes_public:/data alpine ls -la /data
# Configure Git
git config user.name "gitea-actions[bot]"
git config user.email "actions@noreply.gitea.io"
# Move site files to a temporary location
cp -r site /tmp/site_build
# Switch to/create the deployment branch
git checkout --orphan docs-static
git rm -rf .
# Move files back and commit
cp -r /tmp/site_build/. .
git add .
git commit -m "Automated MkDocs build: ${GITEA_SHA}"
# Push back to Gitea (Requires write permissions)
git push origin docs-static --force