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