This commit is contained in:
@@ -1,9 +1,6 @@
|
|||||||
name: Build and Push Static files
|
name: Build and Deploy MkDocs
|
||||||
|
|
||||||
on:
|
on: [push]
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main # Trigger on pushes to your default branch
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
@@ -11,35 +8,27 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Build Docker Image
|
- name: Build and Extract Site
|
||||||
run: docker build -t mkdocs-builder -f ci/mkdocs/Dockerfile .
|
|
||||||
|
|
||||||
- name: Build Static Site
|
|
||||||
run: |
|
run: |
|
||||||
docker run --rm \
|
# Build the image (the 'RUN mkdocs build' happens here)
|
||||||
-v "${{ github.workspace }}:/app" \
|
docker build -t mkdocs-temp -f ci/mkdocs/Dockerfile .
|
||||||
mkdocs-builder build --config-file mkdocs.yml
|
|
||||||
|
# Create a temporary container and copy the 'site' folder out of it
|
||||||
|
docker create --name temp-container mkdocs-temp
|
||||||
|
docker cp temp-container:/build/site ./site
|
||||||
|
docker rm temp-container
|
||||||
|
|
||||||
- name: Deploy to Branch
|
- name: Deploy to Branch
|
||||||
run: |
|
run: |
|
||||||
# Configure Git
|
|
||||||
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"
|
||||||
|
|
||||||
# Move site files to a temporary location
|
# Standard deployment logic
|
||||||
cp -r site /tmp/site_build
|
cp -r site /tmp/site_build
|
||||||
|
|
||||||
# Switch to/create the deployment branch
|
|
||||||
git checkout --orphan docs-static
|
git checkout --orphan docs-static
|
||||||
git rm -rf .
|
git rm -rf .
|
||||||
|
|
||||||
# Move files back and commit
|
|
||||||
cp -r /tmp/site_build/. .
|
cp -r /tmp/site_build/. .
|
||||||
git add .
|
git add .
|
||||||
git commit -m "Automated MkDocs build: ${GITEA_SHA}"
|
git commit -m "Automated MkDocs build"
|
||||||
|
|
||||||
# Push back to Gitea (Requires write permissions)
|
|
||||||
git push origin docs-static --force
|
git push origin docs-static --force
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
FROM python:3.13-slim
|
FROM python:3.11-slim
|
||||||
|
|
||||||
RUN pip install --no-cache-dir \
|
WORKDIR /build
|
||||||
mkdocs \
|
|
||||||
mkdocs-material \
|
|
||||||
mkdocs-minify-plugin
|
|
||||||
|
|
||||||
WORKDIR /app
|
RUN pip install --no-cache-dir mkdocs mkdocs-material mkdocs-minify-plugin
|
||||||
|
|
||||||
ENTRYPOINT ["mkdocs"]
|
COPY . .
|
||||||
|
|
||||||
|
RUN mkdocs build
|
||||||
|
|
||||||
|
CMD ["cp", "-r", "site", "/output"]
|
||||||
|
|||||||
Reference in New Issue
Block a user