From a4138ed2374d7f327c7cde35f336bcb90863649a Mon Sep 17 00:00:00 2001 From: Pratik Borole Date: Thu, 8 Aug 2024 09:26:59 +0530 Subject: [PATCH] ci: FRON-71 disable production auto deployment only --- .github/workflows/deploy.yml | 64 ------------------------------------ vercel.json | 4 ++- 2 files changed, 3 insertions(+), 65 deletions(-) delete mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 13d98b2..0000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: Deploy to Vercel - -on: - workflow_run: - workflows: ['Lint', 'CodeQL'] - types: - - completed - -jobs: - deploy: - # This condition checks if the workflow run was successful and if the target branch is 'dev'. - if: ${{ github.event.workflow_run.conclusion == 'success' && github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'dev' }} - runs-on: ubuntu-latest - - steps: - - name: ⬇️ Checkout code - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - - - name: ⎔ Setup node - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 - with: - node-version: 20 - - - name: Install pnpm - uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d - with: - version: 9 - run_install: true - - - name: Install dependencies - run: pnpm install - - - name: Install Vercel CLI - run: npm install -g vercel@latest - - - name: Deploy to Vercel - run: vercel --token ${{ secrets.VERCEL_TOKEN }} - env: - VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} - VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} - - - name: Set CORS origin on Heroku - if: github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'synchronize' - run: | - PR_NUMBER=${{ github.event.number }} - DEPLOYMENT_URL=$(vercel --token ${{ secrets.VERCEL_TOKEN }} --confirm) - CURRENT_ORIGINS=$(heroku config:get ORIGINS --app ${{ secrets.HEROKU_APP_NAME }}) - NEW_ORIGINS="${CURRENT_ORIGINS},${DEPLOYMENT_URL}" - heroku config:set ORIGINS=$NEW_ORIGINS --app ${{ secrets.HEROKU_APP_NAME }} - heroku config:set PR_${PR_NUMBER}_DEPLOYMENT_URL=$DEPLOYMENT_URL --app ${{ secrets.HEROKU_APP_NAME }} - env: - HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} - - - name: Remove CORS origin from Heroku - if: github.event.action == 'closed' - run: | - PR_NUMBER=${{ github.event.number }} - DEPLOYMENT_URL=$(heroku config:get PR_${PR_NUMBER}_DEPLOYMENT_URL --app ${{ secrets.HEROKU_APP_NAME }}) - CURRENT_ORIGINS=$(heroku config:get ORIGINS --app ${{ secrets.HEROKU_APP_NAME }}) - NEW_ORIGINS=$(echo $CURRENT_ORIGINS | sed "s|,$DEPLOYMENT_URL||g" | sed "s|$DEPLOYMENT_URL,||g" | sed "s|$DEPLOYMENT_URL||g") - heroku config:set ORIGINS=$NEW_ORIGINS --app ${{ secrets.HEROKU_APP_NAME }} - heroku config:unset PR_${PR_NUMBER}_DEPLOYMENT_URL --app ${{ secrets.HEROKU_APP_NAME }} - env: - HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} diff --git a/vercel.json b/vercel.json index 45c873b..540ffc6 100644 --- a/vercel.json +++ b/vercel.json @@ -1,5 +1,7 @@ { "git": { - "deploymentEnabled": false + "deploymentEnabled": { + "main": false + } } }