chore(ci): change to use gitea wiki instead #27

Merged
WorldTeacher merged 1 commits from dev-restructure-dir into main 2025-12-01 09:42:56 +00:00

View File

@@ -4,25 +4,60 @@ on:
branches: branches:
- master - master
- main - main
permissions: paths:
contents: read - "docs/**"
pages: write - "zensical.toml"
id-token: write
jobs: jobs:
deploy: deploy-wiki:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/configure-pages@v5 - name: Checkout repository
- uses: actions/checkout@v5 uses: actions/checkout@v5
- uses: actions/setup-python@v5
- name: Checkout wiki
uses: actions/checkout@v5
with: with:
python-version: 3.x repository: ${{ gitea.repository }}.wiki
- run: pip install zensical path: wiki
- run: zensical build --clean token: ${{ secrets.GITEA_TOKEN }}
- uses: actions/upload-pages-artifact@v4
with: - name: Copy docs to wiki
path: site run: |
- uses: actions/deploy-pages@v4 # Remove old wiki content (except .git)
find wiki -mindepth 1 -maxdepth 1 ! -name '.git' -exec rm -rf {} +
# Copy markdown files maintaining structure
cp -r docs/* wiki/
# Rename index.md to Home.md for wiki homepage
if [ -f wiki/index.md ]; then
mv wiki/index.md wiki/Home.md
fi
# Flatten folder structure for Gitea wiki compatibility
# Move files from subfolders to root with prefixed names
for dir in wiki/*/; do
if [ -d "$dir" ]; then
dirname=$(basename "$dir")
for file in "$dir"*.md; do
if [ -f "$file" ]; then
filename=$(basename "$file")
if [ "$filename" = "index.md" ]; then
mv "$file" "wiki/${dirname}.md"
else
mv "$file" "wiki/${dirname}-${filename}"
fi
fi
done
rm -rf "$dir"
fi
done
- name: Push to wiki
run: |
cd wiki
git config user.name "Gitea Actions"
git config user.email "actions@gitea.local"
git add -A
git diff --staged --quiet || git commit -m "Update wiki from docs [skip ci]"
git push