From 284227dc4f63542b4eb897c0bb5f474d8204e1f4 Mon Sep 17 00:00:00 2001 From: TechQuery Date: Tue, 9 Jan 2024 10:54:38 +0800 Subject: [PATCH] [fix] GitHub action of Main branch --- .github/workflows/main.yml | 40 ++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1703ff4..993f037 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,23 +2,43 @@ name: CI & CD on: push: branches: - - master + - main jobs: Build-and-Deploy: + env: + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Use Node.js - uses: actions/setup-node@v2 + - uses: actions/checkout@v3 + + - uses: pnpm/action-setup@v2 with: - node-version: 14 - cache: yarn - - name: Install & build - run: yarn && yarn build - - name: Deploy + version: 8 + - uses: actions/setup-node@v3 + with: + node-version: 18 + cache: pnpm + - name: Install & Build + run: | + pnpm i --frozen-lockfile + pnpm build + + - name: Deploy to GitHub pages uses: peaceiris/actions-gh-pages@v3 with: publish_dir: ./dist personal_token: ${{ secrets.GITHUB_TOKEN }} force_orphan: true + + - name: Deploy to Vercel + uses: amondnet/vercel-action@v25 + if: ${{ env.VERCEL_TOKEN && env.VERCEL_ORG_ID && env.VERCEL_PROJECT_ID }} + with: + vercel-token: ${{ secrets.VERCEL_TOKEN }} + github-token: ${{ secrets.GITHUB_TOKEN }} + vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} + vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} + working-directory: ./dist + vercel-args: --prod