diff --git a/.gitea/workflows/documentation.yml b/.gitea/workflows/documentation.yml new file mode 100644 index 0000000..9f607fb --- /dev/null +++ b/.gitea/workflows/documentation.yml @@ -0,0 +1,45 @@ +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 + run: | + git config --global user.name "Gitea Bot" + git config --global user.email "bot@gitea.io" + + WIKI_URL="https://${{ gitea.token }}@gitea.archvium.eu/KrzysztofC/Retro_HA.wiki.git" + + git clone "$WIKI_URL" wiki_dir + + rm -rf wiki_dir/* + cp -r docs/wiki/gfm/* wiki_dir/ + + cd wiki_dir + git add . + if ! git diff --cached --quiet; then + git commit -m "Auto-update wiki from CI/CD" + git push origin master + else + echo "No changes to sync." + fi