|
1 | 1 | name: Deploy to Preview |
2 | 2 |
|
3 | | -env: |
4 | | - VERCEL_ORG_ID: ${{ secrets.ORG_ID }} |
5 | | - VERCEL_PROJECT_ID: ${{ secrets.PROJECT_ID }} |
6 | | - |
7 | 3 | on: |
8 | 4 | pull_request: |
9 | 5 | types: [opened, synchronize, reopened] |
10 | 6 |
|
11 | 7 | jobs: |
12 | | - CI: |
13 | | - uses: ./.github/workflows/ci.yml |
| 8 | + e2e-test: |
| 9 | + uses: tzuyi0817/workflows/.github/workflows/test.yml@v1 |
| 10 | + with: |
| 11 | + install-other-deps: pnpm dlx playwright install --with-deps |
| 12 | + test: pnpm test:ci-e2e |
14 | 13 |
|
15 | 14 | deploy: |
16 | | - needs: CI |
17 | | - runs-on: ubuntu-latest |
18 | | - environment: Preview |
19 | | - outputs: |
20 | | - deploymentUrl: ${{ steps.deploy.outputs.deploymentUrl }} |
21 | | - steps: |
22 | | - - uses: actions/checkout@v6 |
23 | | - - name: install pnpm |
24 | | - uses: pnpm/action-setup@v3 |
25 | | - |
26 | | - - name: install Vercel CLI |
27 | | - run: pnpm install --global vercel@latest |
28 | | - |
29 | | - - name: pull Vercel environment information |
30 | | - run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} |
31 | | - |
32 | | - - name: build project artifacts |
33 | | - run: vercel build --token=${{ secrets.VERCEL_TOKEN }} |
34 | | - |
35 | | - - name: deploy project artifacts to Vercel |
36 | | - id: deploy |
37 | | - run: | |
38 | | - vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} > deploy.log |
39 | | - echo "deploymentUrl=$(cat deploy.log)" >> $GITHUB_OUTPUT |
40 | | -
|
41 | | - comment: |
42 | | - needs: deploy |
43 | | - runs-on: ubuntu-latest |
44 | | - permissions: |
45 | | - issues: write |
46 | | - pull-requests: write |
47 | | - steps: |
48 | | - - name: comment URL to PR |
49 | | - uses: actions/github-script@v8 |
50 | | - with: |
51 | | - script: | |
52 | | - github.rest.issues.createComment({ |
53 | | - issue_number: context.issue.number, |
54 | | - owner: context.repo.owner, |
55 | | - repo: context.repo.repo, |
56 | | - body: "Deployed at ${{ env.DEPLOYMENT_URL }}" |
57 | | - }) |
58 | | - env: |
59 | | - DEPLOYMENT_URL: ${{ needs.deploy.outputs.deploymentUrl }} |
| 15 | + needs: e2e-test |
| 16 | + uses: tzuyi0817/workflows/.github/workflows/deploy-vercel.yml@v1 |
| 17 | + secrets: |
| 18 | + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} |
| 19 | + VERCEL_ORG_ID: ${{ secrets.ORG_ID }} |
| 20 | + VERCEL_PROJECT_ID: ${{ secrets.PROJECT_ID }} |
| 21 | + |
| 22 | + with: |
| 23 | + environment: Preview |
| 24 | + create-comment: true |
0 commit comments