Rewrite README links to GitHub in Pages render #67
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 README to GitHub Pages | |
| on: | |
| pull_request: | |
| paths: | |
| - "src/**" | |
| - "test/binding-checker.hs" | |
| - ".github/generate-binding-status.sh" | |
| - ".github/update-readme.sh" | |
| - ".github/verify-sdl-version.sh" | |
| - ".github/template.html" | |
| - ".github/pandoc-rewrite-links.lua" | |
| - ".github/workflows/deploy-readme.yml" | |
| - "README.md" | |
| - "sdl3.cabal" | |
| - "cabal.project" | |
| - "SDL3" | |
| - "SDL3/include/SDL3/**" | |
| push: | |
| branches: [main] | |
| paths: | |
| - "src/**" | |
| - "test/binding-checker.hs" | |
| - ".github/generate-binding-status.sh" | |
| - ".github/update-readme.sh" | |
| - ".github/verify-sdl-version.sh" | |
| - ".github/template.html" | |
| - ".github/pandoc-rewrite-links.lua" | |
| - ".github/workflows/deploy-readme.yml" | |
| - "README.md" | |
| - "sdl3.cabal" | |
| - "cabal.project" | |
| - "SDL3" | |
| - "SDL3/include/SDL3/**" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: true | |
| jobs: | |
| check-readme-status: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up Haskell | |
| uses: haskell-actions/setup@v2 | |
| with: | |
| ghc-version: "9.8.4" | |
| cabal-version: "latest" | |
| - name: Cache Cabal store | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cabal/packages | |
| ~/.cabal/store | |
| dist-newstyle | |
| key: ${{ runner.os }}-cabal-ghc-9.8.4-${{ hashFiles('sdl3.cabal', 'cabal.project', 'test/binding-checker.hs') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cabal-ghc-9.8.4- | |
| ${{ runner.os }}-cabal- | |
| - name: Update Cabal package index | |
| run: cabal update | |
| - name: Verify SDL header version and submodule commit | |
| run: bash ./.github/verify-sdl-version.sh | |
| - name: Verify README status block is current | |
| run: ./.github/update-readme.sh --check | |
| build: | |
| if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| needs: check-readme-status | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up Haskell | |
| uses: haskell-actions/setup@v2 | |
| with: | |
| ghc-version: "9.8.4" | |
| cabal-version: "latest" | |
| - name: Cache Cabal store | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cabal/packages | |
| ~/.cabal/store | |
| dist-newstyle | |
| key: ${{ runner.os }}-cabal-ghc-9.8.4-${{ hashFiles('sdl3.cabal', 'cabal.project', 'test/binding-checker.hs') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cabal-ghc-9.8.4- | |
| ${{ runner.os }}-cabal- | |
| - name: Update Cabal package index | |
| run: cabal update | |
| - name: Verify SDL header version and submodule commit | |
| run: bash ./.github/verify-sdl-version.sh | |
| - name: Update README binding status | |
| run: ./.github/update-readme.sh | |
| - name: Set up Pandoc | |
| uses: r-lib/actions/setup-pandoc@v2 | |
| - name: Render README to static site | |
| run: | | |
| mkdir -p _site | |
| pandoc --standalone \ | |
| -f gfm \ | |
| -t html5 \ | |
| --lua-filter=.github/pandoc-rewrite-links.lua \ | |
| --template=.github/template.html \ | |
| --metadata title="SDL3 Haskell Bindings" \ | |
| -o _site/index.html \ | |
| README.md | |
| - name: Configure GitHub Pages | |
| uses: actions/configure-pages@v5 | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: _site | |
| deploy: | |
| if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| needs: build | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |