47 lines
1.4 KiB
YAML
47 lines
1.4 KiB
YAML
name: Build and Deploy MkDocs
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0 # Important for switching branches
|
|
|
|
- name: Build and Extract Site
|
|
run: |
|
|
docker build -t mkdocs-temp -f ci/mkdocs/Dockerfile .
|
|
docker create --name temp-container mkdocs-temp
|
|
# Copying content to a folder named 'output_content' to avoid naming collisions
|
|
docker cp temp-container:/build/site ./output_content
|
|
docker rm temp-container
|
|
|
|
- name: Deploy to docs-static Branch
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
|
|
# Move built content to a temporary location outside the git tree
|
|
mv output_content /tmp/site_final
|
|
|
|
# Switch to an orphan branch
|
|
git checkout --orphan docs-static
|
|
|
|
# Completely clear the working directory of all tracked files
|
|
git rm -rf .
|
|
|
|
# Copy ONLY the contents of the build folder into the root
|
|
cp -r /tmp/site_final/. .
|
|
|
|
# Add, commit, and force push
|
|
git add .
|
|
git commit -m "Automated MkDocs build: $(date)"
|
|
git push origin docs-static --force
|