57 lines
1.7 KiB
YAML
57 lines
1.7 KiB
YAML
name: Build and Deploy MkDocs
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
deploy-docs:
|
|
runs-on: ubuntu-latest
|
|
# runs-on: self-hosted
|
|
container:
|
|
#image: ubuntu:latest
|
|
#image: python:3.11
|
|
# This community image has node, git, python3, and pip pre-installed
|
|
image: catthehacker/ubuntu:act-22.04
|
|
#image: catthehacker/ubuntu:runner-22.04
|
|
# container runs as a non-root user (usually a user named runner) by default.
|
|
volumes:
|
|
- /var/www/git-pages:/var/www/docs
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install MkDocs & Plugins
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install mkdocs mkdocs-material
|
|
|
|
- name: Build Static Site
|
|
run: mkdocs build
|
|
|
|
- name: Deploy to Web Server Folder
|
|
run: |
|
|
echo "=== CHECKING CURRENT DIRECTORY STRUCTURE ==="
|
|
pwd
|
|
|
|
echo "=== CHECKING MKDOCS OUTPUT ==="
|
|
# Double check if 'site/' actually has files
|
|
if [ -d "site" ]; then
|
|
ls -la site/
|
|
else
|
|
echo "ERROR: 'site/' directory does not exist!"
|
|
exit 1
|
|
fi
|
|
|
|
echo "=== COPYING FILES ==="
|
|
# Ensure target directory exists inside the container environment
|
|
mkdir -p /var/www/docs/test-mkdocs
|
|
rm -rf /var/www/docs/test-mkdocs/*
|
|
cp -R site/* /var/www/docs/test-mkdocs/
|
|
# Force ownership of all files and folders to www-data (UID 33)
|
|
chown -R 33:33 /var/www/docs/test-mkdocs
|
|
|
|
echo "=== VERIFYING DESTINATION INSIDE CONTAINER ==="
|
|
ls -la /var/www/docs/test-mkdocs/
|