Skip to content

Update and standardise GitHub Actions (#2009) #4339

Update and standardise GitHub Actions (#2009)

Update and standardise GitHub Actions (#2009) #4339

name: "Build & deploy to Cloudflare Pages"
on:
push:
workflow_dispatch:
jobs:
deploy:
permissions:
contents: read
deployments: write
runs-on: ubuntu-latest
name: Deploy to Cloudflare Pages
steps:
- name: Checkout repo
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Install Python and just
uses: opensafely-core/setup-action@d9171097dd0d37bdb7bed58f701eb03ff317ed17 # v1.7.0
with:
install-just: true
python-version: "3.11"
- name: Build site
env:
AccessToken: ${{ secrets.GITHUB_TOKEN }}
MKDOCS_SITE_URL: https://docs.opensafely.org
MKDOCS_MULTIREPO_CLEANUP: true
EHRQL_BRANCH: main
run: just build
- name: Add a version file
run: echo ${{ github.sha }} > site/version.html
- name: Publish
if: ${{ github.actor != 'dependabot[bot]' }}
uses: cloudflare/wrangler-action@ebbaa1584979971c8614a24965b4405ff95890e0 # v4.0.0
with:
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_DIRECT_UPLOAD_API_TOKEN }}
command: pages deploy site --project-name=opensafely-docs
gitHubToken: ${{ secrets.GITHUB_TOKEN }}