diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index 51b1c34..ef4290d 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -5,10 +5,11 @@ on: branches: [main] workflow_dispatch: +# Our jobs can only read our repository by default, so that our build (which runs the install scripts of our +# dependencies) can't deploy anything. Only our deploy job can (see its permissions). + permissions: contents: read - pages: write - id-token: write # Only deploy one version of our demo app at a time, letting a deployment that has started finish, since cancelling it # could leave GitHub Pages in an inconsistent state. @@ -31,8 +32,6 @@ jobs: run: bun install --frozen-lockfile - name: Build OpenCOR Plot's demo app run: bun build:demo - - name: Configure GitHub Pages - uses: actions/configure-pages@v6 - name: Upload OpenCOR Plot's demo app uses: actions/upload-pages-artifact@v5 with: @@ -41,6 +40,14 @@ jobs: name: Deploy needs: build runs-on: ubuntu-26.04 + # Note #1: actions/deploy-pages needs to deploy to GitHub Pages and to get an OIDC token to prove where our demo app + # comes from (see https://github.com/actions/deploy-pages#usage). + # Note #2: GitHub Pages must have been enabled for our repository, with GitHub Actions as its source (see + # https://github.com/opencor/plot/settings/pages), since our GITHUB_TOKEN can't enable it (only a token + # with admin rights can, e.g. using actions/configure-pages with its enablement input). + permissions: + pages: write + id-token: write environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }}