Files
nonebot2/.github/workflows/website-preview-cd.yml
dependabot[bot] 56f52f2c9f
Some checks failed
Pyright Lint / Pyright Lint (pydantic-v1) (push) Successful in 1m28s
Site Deploy / publish (push) Failing after 1m26s
Pyright Lint / Pyright Lint (pydantic-v2) (push) Successful in 1m29s
Ruff Lint / Ruff Lint (push) Successful in 1m30s
Code Coverage / Test Coverage (pydantic-v1, ubuntu-latest, 3.12) (push) Failing after 2m24s
Code Coverage / Test Coverage (pydantic-v1, ubuntu-latest, 3.11) (push) Failing after 2m38s
Code Coverage / Test Coverage (pydantic-v2, ubuntu-latest, 3.12) (push) Failing after 2m45s
Code Coverage / Test Coverage (pydantic-v2, ubuntu-latest, 3.10) (push) Failing after 10m14s
Code Coverage / Test Coverage (pydantic-v2, ubuntu-latest, 3.11) (push) Failing after 12m12s
Code Coverage / Test Coverage (pydantic-v2, ubuntu-latest, 3.9) (push) Failing after 13m10s
Code Coverage / Test Coverage (pydantic-v1, ubuntu-latest, 3.10) (push) Failing after 13m49s
Code Coverage / Test Coverage (pydantic-v1, ubuntu-latest, 3.9) (push) Failing after 14m16s
Code Coverage / Test Coverage (pydantic-v1, macos-latest, 3.10) (push) Has been cancelled
Code Coverage / Test Coverage (pydantic-v1, macos-latest, 3.11) (push) Has been cancelled
Code Coverage / Test Coverage (pydantic-v1, macos-latest, 3.12) (push) Has been cancelled
Code Coverage / Test Coverage (pydantic-v1, macos-latest, 3.9) (push) Has been cancelled
Code Coverage / Test Coverage (pydantic-v1, windows-latest, 3.10) (push) Has been cancelled
Code Coverage / Test Coverage (pydantic-v1, windows-latest, 3.11) (push) Has been cancelled
Code Coverage / Test Coverage (pydantic-v1, windows-latest, 3.12) (push) Has been cancelled
Code Coverage / Test Coverage (pydantic-v1, windows-latest, 3.9) (push) Has been cancelled
Code Coverage / Test Coverage (pydantic-v2, macos-latest, 3.10) (push) Has been cancelled
Code Coverage / Test Coverage (pydantic-v2, macos-latest, 3.11) (push) Has been cancelled
Code Coverage / Test Coverage (pydantic-v2, macos-latest, 3.12) (push) Has been cancelled
Code Coverage / Test Coverage (pydantic-v2, macos-latest, 3.9) (push) Has been cancelled
Code Coverage / Test Coverage (pydantic-v2, windows-latest, 3.10) (push) Has been cancelled
Code Coverage / Test Coverage (pydantic-v2, windows-latest, 3.11) (push) Has been cancelled
Code Coverage / Test Coverage (pydantic-v2, windows-latest, 3.12) (push) Has been cancelled
Code Coverage / Test Coverage (pydantic-v2, windows-latest, 3.9) (push) Has been cancelled
⬆️ Bump actions/download-artifact in the actions group (#3618)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-06 14:30:19 +08:00

105 lines
3.3 KiB
YAML

name: Site Deploy (Preview CD)
on:
workflow_run:
workflows: ["Site Deploy (Preview CI)"]
types:
- completed
jobs:
preview-cd:
runs-on: ubuntu-latest
concurrency:
group: pull-request-preview-${{ github.event.workflow_run.head_repository.full_name }}-${{ github.event.workflow_run.head_branch }}
cancel-in-progress: true
if: ${{ github.event.workflow_run.conclusion == 'success' }}
environment: pull request
permissions:
actions: read
statuses: write
pull-requests: write
steps:
- name: Set Commit Status
uses: actions/github-script@v7
with:
script: |
github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.payload.workflow_run.head_sha,
context: 'Website Preview',
description: 'Deploying...',
state: 'pending',
})
- name: Download Artifact
uses: actions/download-artifact@v5
with:
name: website-preview
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- name: Restore Context
run: |
PR_NUMBER=$(cat ./pr-number)
if ! [[ "${PR_NUMBER}" =~ ^[0-9]+$ ]]; then
echo "Invalid PR number: ${PR_NUMBER}"
exit 1
fi
echo "PR_NUMBER=${PR_NUMBER}" >> "${GITHUB_ENV}"
- name: Set Deploy Name
run: |
echo "DEPLOY_NAME=deploy-preview-${PR_NUMBER}" >> "${GITHUB_ENV}"
- name: Deploy to Netlify
id: deploy
uses: nwtgck/actions-netlify@v3
with:
publish-dir: ./website/build
production-deploy: false
deploy-message: "Deploy ${{ env.DEPLOY_NAME }}@${{ github.event.workflow_run.head_sha }}"
alias: ${{ env.DEPLOY_NAME }}
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.SITE_ID }}
# action netlify has no pull request context, so we need to comment by ourselves
- name: Comment on Pull Request
uses: marocchino/sticky-pull-request-comment@v2
with:
header: website
number: ${{ env.PR_NUMBER }}
message: |
:rocket: Deployed to ${{ steps.deploy.outputs.deploy-url }}
- name: Set Commit Status
uses: actions/github-script@v7
if: always()
with:
script: |
if (`${{ job.status }}` === 'success') {
github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.payload.workflow_run.head_sha,
context: 'Website Preview',
description: `Deployed to ${{ steps.deploy.outputs.deploy-url }}`,
state: 'success',
target_url: `${{ steps.deploy.outputs.deploy-url }}`,
})
} else {
github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.payload.workflow_run.head_sha,
context: 'Website Preview',
description: `Deploy ${{ job.status }}`,
state: 'failure',
})
}