Files
Retro_HA/.gitea/workflows/documentation.yml
Krzysztof Cieślik 3f1a523908
All checks were successful
Update Wiki Documentation / generate-docs (push) Successful in 2m14s
ci: fix wiki authentication and handle empty repositories
2026-06-13 22:06:54 +02:00

53 lines
1.6 KiB
YAML

name: Update Wiki Documentation
on:
push:
branches:
- main
jobs:
generate-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Build Markdown Docs
run: |
chmod +x gradlew
./gradlew dokkaGfm
- name: Sync to Wiki
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_ACTOR: ${{ github.actor }}
run: |
git config --global user.name "Gitea Bot"
git config --global user.email "bot@gitea.io"
WIKI_URL="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@gitea.archvium.eu/KrzysztofC/Retro_HA.wiki.git"
# Jeśli repozytorium jest puste, clone może zwrócić błąd, więc robimy fallback
git clone "$WIKI_URL" wiki_dir || (mkdir wiki_dir && cd wiki_dir && git init && git remote add origin "$WIKI_URL" && cd ..)
# Usuwamy stare pliki (oprócz .git)
find wiki_dir -mindepth 1 -maxdepth 1 ! -name '.git' -exec rm -rf {} +
# Kopiujemy nowe pliki
cp -r docs/wiki/gfm/* wiki_dir/
cd wiki_dir
git add .
if ! git diff --cached --quiet; then
git commit -m "docs: auto-update wiki from CI/CD"
git push -u origin master || git push -u origin main || git push -f origin master
else
echo "No changes to sync."
fi