fix: For vercel deployment hang out #21
Workflow file for this run
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
name: Deploy to Vercel preview and test with Playwright | |
on: | |
push: | |
branches: [ develop ] | |
pull_request: | |
branches: [ develop, main, master ] | |
workflow_dispatch: | |
jobs: | |
deploy: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
env: | |
VERCEL_ORG_ID: ${{ vars.VERCEL_ORG_ID }} | |
VERCEL_PROJECT_ID: ${{ vars.VERCEL_PROJECT_ID }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Vercel CLI | |
run: npm install -g vercel | |
- name: Deploy to Vercel preview | |
run: echo "BASE_URL=$(vercel --token ${{ secrets.VERCEL_TOKEN }} --yes)" >> $GITHUB_ENV | |
- name: Use environment variable | |
run: | | |
echo "The value of BASE_URL is $BASE_URL" | |
test: | |
needs: deploy | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
environment: preview | |
env: | |
JWT_ADMIN_EMAIL: ${{ vars.JWT_ADMIN_EMAIL }} | |
JWT_EMAIL: ${{ vars.JWT_EMAIL }} | |
JWT_SECRET: ${{ secrets.JWT_SECRET }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: Output environment variables | |
run: | | |
echo "CI is $CI" | |
echo "BASE_URL is $BASE_URL" | |
- name: Install dependencies | |
run: npm ci | |
- name: Install Playwright browsers | |
run: npx playwright install chromium --with-deps | |
- name: Test with Playwright | |
run: npx playwright test | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 |