From 2b9d1d6d0ad545cb15e6c3f022ef50607a0f9d9b Mon Sep 17 00:00:00 2001 From: Yamagishi Kazutoshi Date: Sun, 28 Mar 2021 00:40:42 +0900 Subject: [PATCH] ci(vercel): add script for ignored build step (#1298) --- .github/workflows/deploy.yml | 25 ------------------------- scripts/check-build-step.sh | 14 ++++++++++++++ vercel.json | 6 ------ 3 files changed, 14 insertions(+), 31 deletions(-) delete mode 100644 .github/workflows/deploy.yml create mode 100755 scripts/check-build-step.sh delete mode 100644 vercel.json diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 09ab3a100..000000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Deploy - -on: - pull_request: - branches: - - '!*' - push: - branches: - - '!*' - tags: - - 'v*' - -jobs: - deploy: - name: Deploy - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Deploy to Vercel - run: npx vercel -S ${VERCEL_SCOPE} -c -t ${VERCEL_TOKEN} --prod - env: - VERCEL_SCOPE: ${{ secrets.VERCEL_SCOPE }} - VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} diff --git a/scripts/check-build-step.sh b/scripts/check-build-step.sh new file mode 100755 index 000000000..78241aedd --- /dev/null +++ b/scripts/check-build-step.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +echo "VERCEL_ENV: $VERCEL_ENV" +echo "VERCEL_GIT_COMMIT_REF: $VERCEL_GIT_COMMIT_REF" + +if [[ "$VERCEL_ENV" != "production" || "$VERCEL_GIT_COMMIT_REF" =~ ^v[[:digit:]]+(\.[[:digit:]]+(\.[[:digit:]]+)?)?$ ]] ; then + # Proceed with the build + echo "✅ - Build can proceed" + exit 1 +else + # Don't build + echo "🛑 - Build cancelled" + exit 0 +fi diff --git a/vercel.json b/vercel.json deleted file mode 100644 index a8cb77941..000000000 --- a/vercel.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "github": { - "autoAlias": false - }, - "version": 2 -}