feat: trigger prerelease by PR label #7
Workflow file for this run
This file contains hidden or 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: Pre-release | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| types: | |
| - opened | |
| - labeled | |
| - synchronize | |
| jobs: | |
| deploy-en: | |
| if: contains(github.event.pull_request.labels.*.name, 'prerelease') | |
| uses: ./.github/workflows/vercel-deploy.yml | |
| with: | |
| environment: preview | |
| prodFlag: '' | |
| secrets: | |
| VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_EN_ID }} | |
| VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
| VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
| deploy-zh-hans: | |
| if: contains(github.event.pull_request.labels.*.name, 'prerelease') | |
| uses: ./.github/workflows/vercel-deploy.yml | |
| with: | |
| environment: preview | |
| prodFlag: '' | |
| secrets: | |
| VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ZH_HANS_ID }} | |
| VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
| VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
| comment-vercel-preview: | |
| if: contains(github.event.pull_request.labels.*.name, 'prerelease') | |
| needs: [deploy-en, deploy-zh-hans] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Comment PR with Vercel Preview Links | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const en_inspect = process.env.EN_INSPECT_URL; | |
| const en_prod = process.env.EN_PROD_URL; | |
| const zh_inspect = process.env.ZH_INSPECT_URL; | |
| const zh_prod = process.env.ZH_PROD_URL; | |
| let body = `**Vercel Deploy Preview**\n\n`; | |
| body += `- 🇺🇸 EN: [Inspect](${en_inspect}) | [Preview](${en_prod})\n`; | |
| body += `- 🇨🇳 ZH-HANS: [Inspect](${zh_inspect}) | [Preview](${zh_prod})`; | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body | |
| }); | |
| env: | |
| EN_INSPECT_URL: ${{ needs.deploy-en.outputs.inspect_url }} | |
| EN_PROD_URL: ${{ needs.deploy-en.outputs.prod_url }} | |
| ZH_INSPECT_URL: ${{ needs.deploy-zh-hans.outputs.inspect_url }} | |
| ZH_PROD_URL: ${{ needs.deploy-zh-hans.outputs.prod_url }} |