From 42152da0702b4ca23463443a2f62ce2d7f1c9d7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Thu, 11 Jul 2024 10:58:22 -0300 Subject: [PATCH] ci: Deploy PR as temporary page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- .github/workflows/ci.yml | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3ee1d92af..57730a21f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,11 +2,17 @@ name: CI on: workflow_dispatch: - pull_request: push: schedule: # Run every 6 days to help us stay on our toes - cron: '0 0 */6 * *' + # Required for write permission in a PR + pull_request_target: + branches: ["master"] + +permissions: + id-token: write + pages: write jobs: test: @@ -35,6 +41,13 @@ jobs: xvfb-run --auto-servernum bun test:ci deploy-page: + environment: + name: 'Pages Preview' + url: ${{ steps.preview_deployment.outputs.page_url }} + permissions: + contents: read + pages: write + id-token: write needs: test runs-on: ubuntu-latest steps: @@ -51,14 +64,28 @@ jobs: run: | bun install --frozen-lockfile bun run build + # This will be used by the deployment PR action + cp -r dist ./_site - name: Deploy 🚀 uses: JamesIves/github-pages-deploy-action@4.1.5 - if: success() && github.event_name != 'pull_request' with: branch: gh-pages folder: dist + - name: Setup Pages + uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5 + + - name: Upload artifact for preview + # Automatically uploads an artifact from the './_site' directory by default + uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3 + + - name: Deploy PR preview 🚀 + id: preview_deployment + uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4 + with: + preview: 'true' + deploy-electron: needs: test runs-on: ${{ matrix.os }}