This repository has been archived by the owner on Feb 2, 2024. It is now read-only.
added comments #34
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update Wiki | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "**.go" | |
- "go.mod" | |
- "go.sum" | |
- ".github/workflows/wiki.yml" | |
permissions: | |
contents: write | |
id-token: write | |
jobs: | |
update-wiki: | |
runs-on: ubuntu-latest | |
name: Update wiki | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
with: | |
path: source | |
- name: Checkout wiki code | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{github.repository}}.wiki | |
path: wiki | |
- name: Setup Go environment | |
uses: actions/setup-go@v4.1.0 | |
with: | |
go-version: ">=1.21.4" | |
cache: true | |
architecture: x64 | |
- name: Install gomarkdoc | |
run: go install github.com/princjef/gomarkdoc/cmd/gomarkdoc@latest | |
- name: Generate wiki | |
run: | | |
rm -rf wiki/* | |
echo "Generated $(date)" > wiki/_Footer.md | |
cd source | |
cp README.md ../wiki/Home.md | |
echo "# Bloodmage Engine" > ../wiki/_Sidebar.md | |
for f in engine/*; do | |
name=$(basename "$f") | |
echo "Generating documentation for $name" | |
gomarkdoc --output "../wiki/$name.md" "github.com/bloodmagesoftware/bloodmage-engine/engine/$name" | |
echo "- [$name](${{ github.server_url }}/${{ github.repository }}/wiki/$name)" >> ../wiki/_Sidebar.md | |
done | |
cd .. | |
- name: Upload new wiki | |
run: | | |
cd wiki | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add . | |
git diff-index --quiet HEAD || git commit -m "Add changes" && git push |