diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index db36e24..73770f1 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -1,34 +1,43 @@ name: Build and Deploy MkDocs -on: [push] +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: | - # Build the image (the 'RUN mkdocs build' happens here) 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 cp temp-container:/build/site ./site docker rm temp-container - - name: Deploy to Branch + - name: Deploy to docs-static Branch run: | git config user.name "gitea-actions[bot]" git config user.email "actions@noreply.gitea.io" - # Standard deployment logic - cp -r site /tmp/site_build + # Create fresh orphan branch 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 commit -m "Automated MkDocs build" + git push origin docs-static --force