name: Deploy to GitHub Pages on: push: branches: [main] workflow_dispatch: # Top-level read permission; write permissions scoped to the deploy job. permissions: contents: read concurrency: group: pages cancel-in-progress: true env: RUNTIME_VERSION: "0.9" jobs: build: name: Build web bundle runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v6 - name: Set up Python 3.11 uses: actions/setup-python@v6 with: python-version: "3.11" cache: pip - name: Syntax check run: python -m py_compile main.py arcade_app.py - name: Build web bundle # Build the regular browser bundle plus the iOS fullscreen variant at /ios/. # The Makefile handles the repo's browser-build dependencies and avoids # any runtime dependency on the external pygame-web CDN. run: make web-pages-build - name: Verify build output # Fail fast if the Pages artifact is missing the entry point or runtime. run: | test -f build/web/index.html || { echo "build/web/index.html missing"; exit 1; } test -f build/web/manifest.webmanifest || { echo "build/web/manifest.webmanifest missing"; exit 1; } test -f build/web/favicon.ico || { echo "build/web/favicon.ico missing"; exit 1; } test -f build/web/icons/icon-192.png || { echo "build/web/icons/icon-192.png missing"; exit 1; } test -f build/web/icons/maskable-512.png || { echo "build/web/icons/maskable-512.png missing"; exit 1; } test -f build/web/og-image.png || { echo "build/web/og-image.png missing"; exit 1; } test -f build/web/coi-serviceworker.js || { echo "build/web/coi-serviceworker.js missing"; exit 1; } test -f build/web/archives/${RUNTIME_VERSION}/pythons.js || { echo "build/web/archives/${RUNTIME_VERSION}/pythons.js missing"; exit 1; } test -f build/web/archives/${RUNTIME_VERSION}/browserfs.min.js || { echo "build/web/archives/${RUNTIME_VERSION}/browserfs.min.js missing"; exit 1; } test -f build/web/archives/${RUNTIME_VERSION}/vt/xterm.css || { echo "build/web/archives/${RUNTIME_VERSION}/vt/xterm.css missing"; exit 1; } test -f build/web/ios/index.html || { echo "build/web/ios/index.html missing"; exit 1; } test -f build/web/ios/manifest.webmanifest || { echo "build/web/ios/manifest.webmanifest missing"; exit 1; } test -f build/web/ios/archives/${RUNTIME_VERSION}/pythons.js || { echo "build/web/ios/archives/${RUNTIME_VERSION}/pythons.js missing"; exit 1; } - name: Upload Pages artifact uses: actions/upload-pages-artifact@v5 with: path: build/web deploy: name: Deploy to GitHub Pages needs: build runs-on: ubuntu-latest # Pages deployment needs write access to pages and an OIDC token. permissions: pages: write id-token: write environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} steps: - name: Deploy id: deployment uses: actions/deploy-pages@v5