Deploy API (GitHub Pages) #894
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 API (GitHub Pages) | |
| on: | |
| push: | |
| branches: [ main ] | |
| schedule: | |
| - cron: '0 * * * *' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Fetch github stats | |
| run: python3 scripts/fetch-stats.py | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build static site and API | |
| run: | | |
| set -euo pipefail | |
| python3 --version | |
| rm -rf public | |
| mkdir -p public | |
| if [ -d public_html ]; then | |
| cp -r public_html/. public/ | |
| fi | |
| python3 scripts/API/emit_static_api.py | |
| echo "[ls] public/" | |
| ls -lah public || true | |
| echo "[ls] public/api/" | |
| ls -lah public/api || true | |
| echo "[ls] public/api/v1/" | |
| ls -lah public/api/v1 || true | |
| test -f public/api/v1/index.json || { echo "::error ::public/api/v1/index.json missing"; exit 1; } | |
| test -f public/api/v1/plugins.json || { echo "::error ::public/api/v1/plugins.json missing"; exit 1; } | |
| - name: Debug Queue Manager in built API | |
| run: | | |
| jq '.plugins[] | select(.repo=="GabiRP/QueueManager")' public/api/v1/index.json || true | |
| jq '.[] | select(.repo=="GabiRP/QueueManager")' public/api/v1/plugins.json || true | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./public | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |