47 lines
1.1 KiB
YAML
47 lines
1.1 KiB
YAML
name: Build and Deploy MkDocs
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main # change if needed
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Build and Extract Site
|
|
run: |
|
|
docker build -t mkdocs-temp -f ci/mkdocs/Dockerfile .
|
|
docker create --name temp-container mkdocs-temp
|
|
docker cp temp-container:/build/site ./site
|
|
docker rm temp-container
|
|
|
|
- name: Deploy to docs-static Branch
|
|
run: |
|
|
git config user.name "gitea-actions[bot]"
|
|
git config user.email "actions@noreply.gitea.io"
|
|
|
|
# Move built site somewhere safe
|
|
mv site /tmp/site_build
|
|
|
|
# Create orphan branch
|
|
git checkout --orphan docs-static
|
|
|
|
# Remove tracked files
|
|
git rm -rf . 2>/dev/null || true
|
|
|
|
# Clean working directory
|
|
rm -rf *
|
|
|
|
# Copy ONLY built output back in
|
|
cp -r /tmp/site_build/. .
|
|
|
|
git add .
|
|
git commit -m "Automated MkDocs build"
|
|
|
|
git push origin docs-static --force
|