Skip to content

Misc corrections for parallel PDF build changes #19601

Misc corrections for parallel PDF build changes

Misc corrections for parallel PDF build changes #19601

Workflow file for this run

name: Deploy branch draft on Netlify
on:
pull_request:
types: [labeled, opened, synchronize]
workflow_dispatch:
concurrency:
group: ${{ github.head_ref }}
cancel-in-progress: true
jobs:
build-pages:
if: |
(
(github.event.action == 'labeled' && github.event.label.name == 'deploy') ||
(contains(github.event.pull_request.labels.*.name, 'deploy'))
) && !github.event.pull_request.head.repo.fork
uses: ./.github/workflows/build-pages.yml
with:
ref: ${{ github.head_ref }}
sha: ${{ github.event.pull_request.head.sha }}
secrets: inherit
build-pdfs:
if: |
(
(github.event.action == 'labeled' && github.event.label.name == 'deploy-pdfs') ||
(contains(github.event.pull_request.labels.*.name, 'deploy-pdfs'))
) && !github.event.pull_request.head.repo.fork
uses: ./.github/workflows/build-pdfs.yml
with:
ref: ${{ github.head_ref }}
sha: ${{ github.event.pull_request.head.sha }}
# this serves to allow building PDFs to be optional without preventing deployment,
# while still failing the workflow if we *try* to build PDFs and fail
# there are ways to do this in conditions on a single job, but this keeps things clear
# this job will fail only if build-pdfs failed (not if it was skipped)
# however, it will set an output - check-has-pdfs.steps.check.has-pdfs - true if PDFs were generated
check-has-pdfs:
runs-on: ubuntu-22.04
needs: build-pdfs
if: ${{ always() }}
outputs:
cache-key: ${{ steps.check.outputs.cache-key }}
has-pdfs: ${{ steps.check.outputs.has-pdfs }}
steps:
- name: check
id: check
run: |
echo "cache-key=${{ needs.build-pdfs.outputs.cache-key }}" >> "$GITHUB_OUTPUT"
echo "has-pdfs=${{ needs.build-pdfs.result == 'success' }}" >> "$GITHUB_OUTPUT"
exit ${{ needs.build-pdfs.result == 'failure' && 1 || 0 }}
deploy-to-netlify:
needs: [build-pages, check-has-pdfs]
# succeeded() (the default check) will be false at this point if PDFs were skipped
if: ${{ !cancelled() && needs.build-pages.result == 'success' && needs.check-has-pdfs.result == 'success' }}
uses: ./.github/workflows/deploy-to-netlify.yml
with:
pages-cache-key: ${{ needs.build-pages.outputs.cache-key }}
pdf-cache-key: ${{ needs.check-has-pdfs.outputs.cache-key }}
enable-commit-comment: false
alias: deploy-preview-${{ github.event.number }}
secrets:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_DEVELOP_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}