102 lines
3.4 KiB
YAML
102 lines
3.4 KiB
YAML
name: Reusable Deploy Landing Preview
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
CONCURRENCY:
|
|
required: true
|
|
type: string
|
|
PR_NUMBER:
|
|
required: true
|
|
type: string
|
|
|
|
concurrency:
|
|
group: ${{ inputs.CONCURRENCY }}-deploy-landing-preview
|
|
cancel-in-progress: true
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash --noprofile --norc -euo pipefail {0}
|
|
|
|
permissions:
|
|
contents: "write"
|
|
id-token: "write"
|
|
pull-requests: "write"
|
|
|
|
jobs:
|
|
deploy:
|
|
name: Deploy
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.ref) || '' }}
|
|
|
|
- name: Get sha
|
|
id: get-sha
|
|
run: |
|
|
full_commit="${{ (github.event_name == 'pull_request' && github.event.pull_request.head.sha) || github.sha }}"
|
|
echo "sha=$full_commit" >> "$GITHUB_OUTPUT"
|
|
|
|
- uses: prefix-dev/setup-pixi@v0.10.0
|
|
with:
|
|
pixi-version: v0.71.3
|
|
|
|
- id: "auth"
|
|
uses: google-github-actions/auth@v2
|
|
with:
|
|
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
|
|
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
|
|
|
|
- name: "Upload PR-preview markdown docs & examples to GCS"
|
|
env:
|
|
ISR_BYPASS_TOKEN: ${{ secrets.ISR_BYPASS_TOKEN }}
|
|
PR_NUMBER: ${{ inputs.PR_NUMBER }}
|
|
RERUN_COMMIT: ${{ steps.get-sha.outputs.sha }}
|
|
run: |
|
|
# PR previews live under `gs://rerun-docs/prose/pr-{N}/` and
|
|
# are not advertised in versions.json. The production website
|
|
# reads them directly via `/docs/pr-{N}/…`, so re-uploads
|
|
# must purge that subtree from the edge ISR cache.
|
|
pixi run uv run scripts/ci/upload_docs.py upload \
|
|
--version "pr-${PR_NUMBER}" \
|
|
--rerun-commit "$RERUN_COMMIT" \
|
|
--purge-token "$ISR_BYPASS_TOKEN"
|
|
|
|
- name: Create PR comment
|
|
uses: mshick/add-pr-comment@v2.8.2
|
|
# GitHub API is very unreliable. We don't want to fail the entire workflow just because we couldn't post a comment.
|
|
continue-on-error: true
|
|
if: success()
|
|
with:
|
|
message-id: "vercel-preview"
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
message: |
|
|
Latest documentation preview uploaded successfully.
|
|
|
|
| Result | Commit | Link |
|
|
| ------ | ------- | ----- |
|
|
| ✅ | ${{ steps.get-sha.outputs.sha }} | https://rerun.io/docs/pr-${{ inputs.PR_NUMBER }} |
|
|
|
|
<sup>Note: This comment is updated whenever you push a commit.</sup>
|
|
|
|
- name: Create PR comment
|
|
uses: mshick/add-pr-comment@v2.8.2
|
|
# GitHub API is very unreliable. We don't want to fail the entire workflow just because we couldn't post a comment.
|
|
continue-on-error: true
|
|
if: failure()
|
|
with:
|
|
message-id: "vercel-preview"
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
message: |
|
|
Latest documentation preview failed to upload, check the CI for more details:
|
|
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}?pr=${{ github.event.pull_request.number }}
|
|
|
|
| Result | Commit | Link |
|
|
| ------ | ------- | ----- |
|
|
| ❌ | ${{ steps.get-sha.outputs.sha }} | unavailable |
|
|
|
|
<sup>Note: This comment is updated whenever you push a commit.</sup>
|