Publish PR preview #329
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
on: | |
workflow_run: | |
workflows: ["PR preview"] | |
types: [completed] | |
name: Publish PR preview | |
jobs: | |
publish: | |
name: Publish PR preview | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
steps: | |
- name: Download HTML artifact | |
uses: dawidd6/action-download-artifact@09f2f74827fd3a8607589e5ad7f9398816f540fe # v3.1.4 | |
with: | |
name: website-html | |
path: dist | |
run_id: ${{ github.event.workflow_run.id }} | |
- name: Download Functions artifact | |
uses: dawidd6/action-download-artifact@09f2f74827fd3a8607589e5ad7f9398816f540fe # v3.1.4 | |
with: | |
name: website-functions | |
path: functions | |
run_id: ${{ github.event.workflow_run.id }} | |
- name: Download package artifact | |
uses: dawidd6/action-download-artifact@09f2f74827fd3a8607589e5ad7f9398816f540fe # v3.1.4 | |
with: | |
name: website-package | |
run_id: ${{ github.event.workflow_run.id }} | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
cache: "npm" | |
node-version: "20" | |
- name: Install dependencies | |
run: npm ci | |
# TODO this action is deprecated! | |
- name: Gather PR details | |
uses: potiuk/get-workflow-origin@e2dae063368361e4cd1f510e8785cd73bca9352e # v1_5 (v1_6 is broken!) | |
id: pr-details | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
sourceRunId: ${{ github.event.workflow_run.id }} | |
- name: Publish to Pages | |
uses: cloudflare/pages-action@1 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
projectName: quiltmc-org | |
directory: dist | |
branch: preview-${{ steps.pr-details.outputs.pullRequestNumber }} |