Skip to content

treewide: preliminary b300 support #2389

treewide: preliminary b300 support

treewide: preliminary b300 support #2389

Workflow file for this run

name: publish docs to GitHub Pages
on:
workflow_dispatch:
push:
branches:
- main
paths:
- docs/**
- "!docs/README.md"
- .github/workflows/docs_publish.yml
- packages/by-name/contrast/docs/**
pull_request:
types:
- opened
- reopened
- synchronize
- closed
paths:
- docs/**
- "!docs/README.md"
- .github/workflows/docs_publish.yml
- packages/by-name/contrast/docs/**
permissions:
contents: write
pull-requests: write
concurrency:
group: docs-deploy
cancel-in-progress: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
jobs:
deploy:
name: Publish docs to GitHub Pages
runs-on: ubuntu-24.04
# Prevent the job from running on forked PRs, for security reasons.
if: |
(github.event_name == 'push' && github.ref_name == 'main') ||
(github.event_name == 'workflow_dispatch' && github.ref_name == 'main') ||
(github.event_name == 'pull_request' && github.repository_owner == github.event.pull_request.head.repo.owner.login)
env:
PREVIEW: ${{ github.event_name == 'pull_request' }}
SET: base
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: ./.github/actions/setup_nix
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
cachixToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Build production website
if: env.PREVIEW == 'false'
run: |
nix build -L ".#${SET}.contrast.docs"
- name: Publish docs to GitHub Pages
if: env.PREVIEW == 'false'
uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # v4.8.0
with:
folder: ./result
branch: gh-pages
clean-exclude: pr-preview
force: false
- name: Build preview website
if: env.PREVIEW == 'true'
run: |
nix build -L --impure --expr "(builtins.getFlake \"git+file://$(pwd)?shallow=1\").outputs.legacyPackages.x86_64-linux.${SET}.contrast.docs.override { docusaurusBaseUrl = \"contrast/pr-preview/pr-${{ github.event.number }}\"; }"
- name: Deploy preview
if: env.PREVIEW == 'true'
uses: rossjrw/pr-preview-action@ffa7509e91a3ec8dfc2e5536c4d5c1acdf7a6de9 # v1.8.1
with:
source-dir: ./result