diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000..28ccdf1 --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,48 @@ +name: Deploy Pages on PR merge + +on: + pull_request: + branches: + - main + types: + - closed + +permissions: + contents: read + +concurrency: + group: github-pages + cancel-in-progress: true + +jobs: + deploy: + # A closed PR that was not merged must not build or deploy anything. + if: ${{ github.event.pull_request.merged == true }} + runs-on: ubuntu-latest + permissions: + contents: read + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + steps: + - name: Checkout merged main + uses: actions/checkout@v4 + with: + ref: main + + - name: Prepare static site + run: | + mkdir -p _site + cp index.html _site/index.html + + - name: Upload Pages artifact + uses: actions/upload-pages-artifact@v3 + with: + path: _site + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v5