This commit is contained in:
@@ -1,34 +1,43 @@
|
|||||||
name: Build and Deploy MkDocs
|
name: Build and Deploy MkDocs
|
||||||
|
|
||||||
on: [push]
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main # change if needed
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Build and Extract Site
|
- name: Build and Extract Site
|
||||||
run: |
|
run: |
|
||||||
# Build the image (the 'RUN mkdocs build' happens here)
|
|
||||||
docker build -t mkdocs-temp -f ci/mkdocs/Dockerfile .
|
docker build -t mkdocs-temp -f ci/mkdocs/Dockerfile .
|
||||||
|
|
||||||
# Create a temporary container and copy the 'site' folder out of it
|
|
||||||
docker create --name temp-container mkdocs-temp
|
docker create --name temp-container mkdocs-temp
|
||||||
docker cp temp-container:/build/site ./site
|
docker cp temp-container:/build/site ./site
|
||||||
docker rm temp-container
|
docker rm temp-container
|
||||||
|
|
||||||
- name: Deploy to Branch
|
- name: Deploy to docs-static Branch
|
||||||
run: |
|
run: |
|
||||||
git config user.name "gitea-actions[bot]"
|
git config user.name "gitea-actions[bot]"
|
||||||
git config user.email "actions@noreply.gitea.io"
|
git config user.email "actions@noreply.gitea.io"
|
||||||
|
|
||||||
# Standard deployment logic
|
# Create fresh orphan branch
|
||||||
cp -r site /tmp/site_build
|
|
||||||
git checkout --orphan docs-static
|
git checkout --orphan docs-static
|
||||||
git rm -rf .
|
|
||||||
cp -r /tmp/site_build/. .
|
# Remove ALL tracked files from index + working tree
|
||||||
|
git rm -rf . 2>/dev/null || true
|
||||||
|
|
||||||
|
# Clean untracked files too (important!)
|
||||||
|
rm -rf *
|
||||||
|
|
||||||
|
# Copy only site contents (not the folder itself)
|
||||||
|
cp -r site/. .
|
||||||
|
|
||||||
git add .
|
git add .
|
||||||
git commit -m "Automated MkDocs build"
|
git commit -m "Automated MkDocs build"
|
||||||
|
|
||||||
git push origin docs-static --force
|
git push origin docs-static --force
|
||||||
|
|||||||
Reference in New Issue
Block a user