# https://cn.vitejs.dev/guide/static-deploy name: CI on: push: branches: - main pull_request: workflow_dispatch: concurrency: group: 'ci' cancel-in-progress: true jobs: build-and-deploy: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - run: | sed -i '/use-node-version/d' .npmrc; sed -i '/node-mirror/d' .npmrc; - uses: pnpm/action-setup@v4 name: Install pnpm with: version: 9 run_install: false - name: Install Node.js uses: actions/setup-node@v4 with: node-version: 20 cache: 'pnpm' - name: Install dependencies run: pnpm install --frozen-lockfile - name: Lint run: pnpm lint # - name: Build # run: pnpm build # env: # VITE_BUILD_COMMIT: ${{ github.sha }} # https://github.com/vercel/examples/tree/main/ci-cd/github-actions # cname-china.vercel-dns.com # cname-cn.vercel.com # - name: Install Vercel CLI # run: npm install --global vercel@canary - name: Pull Vercel Environment Information run: pnpm exec vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} - name: Build Project Artifacts run: pnpm exec vercel build --target=production --token=${{ secrets.VERCEL_TOKEN }} env: VITE_BUILD_COMMIT: ${{ github.sha }} - name: Deploy Project Artifacts to Vercel run: pnpm exec vercel deploy --prebuilt --target=production --token=${{ secrets.VERCEL_TOKEN }} # https://github.com/Tencent/tdesign-vue-next/pull/1604#issuecomment-1236244550 - name: Surge # pnpm exec surge token / pnpx surge token run: | cp dist/index.html dist/200.html pnpm exec surge dist https://vue-ts-example.surge.sh --token ${{ secrets.SURGE_TOKEN }} # test: # needs: build-and-deploy # timeout-minutes: 60 # runs-on: ubuntu-latest # steps: # - uses: actions/checkout@v4 # - uses: actions/setup-node@v4 # with: # node-version: lts/* # - name: Install dependencies # run: npm install -g pnpm && pnpm install - name: Install Playwright Browsers run: pnpm exec playwright install --with-deps - name: Run Playwright tests run: pnpm exec playwright test # - uses: actions/upload-artifact@v4 # if: ${{ !cancelled() }} # with: # name: playwright-report # path: playwright-report/ # retention-days: 30