From b1fd1c739290b0001cd1045ca5cd669cbd56f5a7 Mon Sep 17 00:00:00 2001 From: Sumit Kolhe <35036894+sumitkolhe@users.noreply.github.com> Date: Sun, 24 Mar 2024 12:17:21 +0530 Subject: [PATCH] ci: add gh action for release and tests --- .github/workflows/ci.yaml | 8 ++++++- .github/workflows/release.yaml | 38 ++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ef60b006..f162131f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,8 +1,11 @@ name: CI on: [push, pull_request] +branches: + - main + jobs: relase: - name: Test and Deploy + name: Test and Deploy to Staging runs-on: ubuntu-latest steps: - name: Checkout Code @@ -19,6 +22,9 @@ jobs: uses: oven-sh/setup-bun@v1.2.0 - run: bun install + - name: Run Tests + run: bun run test + - name: Deploy to Staging id: deploy-vercel-staging uses: amondnet/vercel-action@v25.2.0 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 00000000..fe14ab44 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,38 @@ +name: Deploy To Production +on: + push: + tags: + - '*' + +jobs: + deploy-production: + name: Run Tests and Deploy to Production + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Cache Dependencies + uses: actions/cache@v4.0.2 + with: + path: ~/.bun + key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }} + restore-keys: ${{ runner.os }}-bun- + + - name: Setup Bun + uses: oven-sh/setup-bun@v1.2.0 + - run: bun install + + - name: Run Tests + run: bun run test + + - name: Deploy to Production + uses: amondnet/vercel-action@v25.2.0 + id: deploy-vercel-production + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + with: + vercel-token: ${{ secrets.VERCEL_TOKEN }} + vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} + vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID_TL_ENGINE }} + vercel-args: --prod + scope: ${{ secrets.VERCEL_ORG_ID }}