Upload Preview #2688
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
# 把 PR 构建的页面推送到 Netlify | |
# 由于涉及 secrets,所以不能直接在 build.yml 中配置 | |
name: Upload Preview | |
on: | |
workflow_run: | |
workflows: ['Build', 'Storybook Build'] | |
types: | |
- completed | |
jobs: | |
upload: | |
concurrency: | |
group: upload-preview-${{ github.event.workflow_run.head_repository.owner.login }}-${{ github.event.workflow_run.head_branch }} | |
cancel-in-progress: false | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event != 'push' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup-js-env | |
- run: echo '${{ toJSON(github.event) }}' | |
- run: npm i -g wrangler | |
- run: npx tsx ./.github/scripts/upload-preview.mts | |
env: | |
workflow_name: '${{ github.event.workflow.name }}' | |
GH_TOKEN: ${{ github.token }} | |
RUN_ID: ${{ github.event.workflow_run.id }} | |
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
CLOUDFLARE_PROJECT_NAME: bangumi-frontend |