feat: add api/env #26
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: Prerelease | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| types: | |
| - opened | |
| - labeled | |
| - synchronize | |
| permissions: | |
| pull-requests: write | |
| issues: write | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - locale: en | |
| secret_project_id: VERCEL_PROJECT_EN_ID | |
| - locale: zh-hans | |
| secret_project_id: VERCEL_PROJECT_ZH_HANS_ID | |
| - locale: zh-hant | |
| secret_project_id: VERCEL_PROJECT_ZH_HANT_ID | |
| name: Deploy ${{ matrix.locale }} | |
| steps: | |
| # If the label is 'prerelease', all jobs run. | |
| # If the label is 'prerelease:zh-hant', only the zh-hant job runs, etc. | |
| - name: Skip if not matching label | |
| if: | | |
| github.event_name == 'pull_request' && | |
| !contains(github.event.pull_request.labels.*.name, 'prerelease') && | |
| !contains(github.event.pull_request.labels.*.name, format('prerelease:{0}', matrix.locale)) | |
| run: | | |
| echo "Skipping deploy for ${{ matrix.locale }} due to missing label." | |
| exit 0 | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 1 | |
| - name: Setup Tools | |
| uses: ./.github/actions/setup | |
| - name: Deploy to Vercel (${{ matrix.locale }}) | |
| id: deploy | |
| uses: ./.github/actions/vercel-deploy | |
| with: | |
| environment: preview | |
| vercel_project_id: ${{ secrets[matrix.secret_project_id] }} | |
| vercel_org_id: ${{ secrets.VERCEL_ORG_ID }} | |
| vercel_token: ${{ secrets.VERCEL_TOKEN }} | |
| - name: Comment PR with Vercel Preview Links (${{ matrix.locale }}) | |
| uses: ./.github/actions/comment-vercel-preview | |
| with: | |
| inspect_url: ${{ steps.deploy.outputs.inspect_url }} | |
| preview_url: ${{ steps.deploy.outputs.prod_url }} | |
| label: ${{ matrix.locale }} |