From 9a9f63d1d1c7048efbc6b280027bb5d4909a6710 Mon Sep 17 00:00:00 2001 From: Pedro Frattezi Silva Date: Sat, 15 Jun 2024 20:08:44 -0300 Subject: [PATCH] chore: update cicd script --- .github/workflows/merge-request.yaml | 59 +++++++++++++++++++++------- .vscode/settings.json | 2 +- 2 files changed, 46 insertions(+), 15 deletions(-) diff --git a/.github/workflows/merge-request.yaml b/.github/workflows/merge-request.yaml index 51b7032..70d4586 100644 --- a/.github/workflows/merge-request.yaml +++ b/.github/workflows/merge-request.yaml @@ -1,25 +1,56 @@ -name: Merge Request Quality Gate +name: Deploy to Vercel on: pull_request jobs: - lint-and-build: + lint-and-test: runs-on: ubuntu-latest - name: Lint and build steps: - - uses: actions/checkout@v3 + - name: Checkout code + uses: actions/checkout@v3 - - name: Setup node 20 - uses: actions/setup-node@v3 - with: - node-version: 20.x + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: 20 - - name: Install dependencies - run: yarn + - name: Install dependencies + run: yarn - - name: Lint code - run: yarn lint + - name: Run lint + run: yarn lint - - name: Check build - run: yarn build + # - name: Run tests + # run: yarn test + + build-and-deploy: + runs-on: ubuntu-latest + environment: Production + needs: lint-and-test + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Node + uses: actions/setup-node@v3 + with: + node-version: 20 + + - name: Install dependencies + run: echo ${{ secrets.DATABASE_URL }} + + - name: Install dependencies + run: echo ${{ secrets.DATABASE_URL }} > .env + + - name: Install dependencies + run: yarn + + - name: Run database migrations + run: npx prisma migrate dev + + - name: Deploy to Vercel + run: vercel --prod + env: + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} diff --git a/.vscode/settings.json b/.vscode/settings.json index 5da11b4..1c3519f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -13,5 +13,5 @@ "[json]": { "editor.defaultFormatter": "biomejs.biome" }, - "cSpell.words": ["biomejs", "lefthook", "tailwindcss"] + "cSpell.words": ["biomejs", "lefthook", "tailwindcss", "Vercel"] }