Pull Request Preview #68
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pull Request Preview | |
on: | |
workflow_run: | |
workflows: ["Pull Request Build"] | |
types: | |
- completed | |
permissions: | |
pull-requests: write # allow surge-preview to create/update PR comments | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.workflow_run.id }} | |
cancel-in-progress: true | |
jobs: | |
# NOTE: match job name in pull_request.yaml | |
preview: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }} | |
steps: | |
# Ensure folder exists for PR 'closed' case | |
- run: mkdir html | |
# Download built HTML from PR Build workflow | |
- uses: actions/download-artifact@v4 | |
continue-on-error: true | |
with: | |
github-token: ${{ github.token }} | |
run-id: ${{ github.event.workflow_run.id }} | |
- name: Manage Surge.sh Deployment | |
id: preview_step | |
uses: afc163/surge-preview@v1 | |
with: | |
surge_token: ${{ secrets.SURGE_TOKEN }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
build: echo 'Uploading html/ folder contents to Surge.sh...' | |
dist: html # NOTE: match upload_artifact name in pull_request.yaml | |
failOnError: true | |
teardown: true |