Deploy Wiki to GitHub Pages #6
This file contains hidden or 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: Deploy Wiki to GitHub Pages | |
| on: | |
| push: | |
| branches: | |
| - stable | |
| workflow_dispatch: | |
| # Needs to push the built site to the gh-pages branch. | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: pages-deploy | |
| cancel-in-progress: false | |
| jobs: | |
| build-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # No `uses:` actions on purpose: action-download resolution has an outage often enough that a plain | |
| # git clone (which only needs the runner's git) is more reliable. The site is rendered to static HTML | |
| # here and pushed with a .nojekyll marker, so GitHub Pages runs no Jekyll build to fail on. | |
| - name: Build and deploy | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| set -e | |
| python3 -m pip install --quiet markdown | |
| git clone --depth 1 -b stable \ | |
| "https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" repo | |
| cd repo | |
| curl -sfL \ | |
| https://raw.githubusercontent.com/Slimefun5/Slimefun5/stable/core/src/main/resources/languages/en/items.yml \ | |
| -o items.yml || echo "items.yml unavailable - building without item redirects" | |
| python3 src/generate-wiki.py \ | |
| --pages pages --items items.yml --plugin slimefun --base /Wiki --out _site | |
| cd _site | |
| git init -q -b gh-pages | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add -A | |
| git commit -qm "deploy: regenerate wiki site" | |
| git push -f "https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" gh-pages:gh-pages |