From 96e9e5f42ae3e9bfc5a26edce08c6d5d1f9809bc Mon Sep 17 00:00:00 2001 From: Kevin Mauel Date: Thu, 3 Oct 2024 09:51:39 +0200 Subject: [PATCH] feat: add workflows for preview and production deploy to vercel --- .github/workflows/vercel/preview.yaml | 32 ++++++++++++++++++++++++ .github/workflows/vercel/production.yaml | 32 ++++++++++++++++++++++++ .gitignore | 1 + 3 files changed, 65 insertions(+) create mode 100644 .github/workflows/vercel/preview.yaml create mode 100644 .github/workflows/vercel/production.yaml diff --git a/.github/workflows/vercel/preview.yaml b/.github/workflows/vercel/preview.yaml new file mode 100644 index 000000000..6f39b2b4d --- /dev/null +++ b/.github/workflows/vercel/preview.yaml @@ -0,0 +1,32 @@ +name: Vercel Preview Deployment +env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} +on: + push: + branches-ignore: + - master +jobs: + Deploy-Preview: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Use Node.js 18.17 + uses: actions/setup-node@v4 + with: + node-version: 18.17 + cache: 'yarn' + env: + DATABASE_TYPE: postgresql + - run: npm install --global yarn + - run: yarn install + - run: yarn test + - run: yarn build + - name: Install Vercel CLI + run: npm install --global vercel@latest + - name: Pull Vercel Environment Information + run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} + - name: Build Project Artifacts + run: vercel build --token=${{ secrets.VERCEL_TOKEN }} + - name: Deploy Project Artifacts to Vercel + run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/vercel/production.yaml b/.github/workflows/vercel/production.yaml new file mode 100644 index 000000000..4bb1c5c65 --- /dev/null +++ b/.github/workflows/vercel/production.yaml @@ -0,0 +1,32 @@ +name: Vercel Production Deployment +env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} +on: + push: + branches: + - master +jobs: + Deploy-Production: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Use Node.js 18.17 + uses: actions/setup-node@v4 + with: + node-version: 18.17 + cache: 'yarn' + env: + DATABASE_TYPE: postgresql + - run: npm install --global yarn + - run: yarn install + - run: yarn test + - run: yarn build + - name: Install Vercel CLI + run: npm install --global vercel@latest + - name: Pull Vercel Environment Information + run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} + - name: Build Project Artifacts + run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} + - name: Deploy Project Artifacts to Vercel + run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index b11f45093..b08104ec1 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,4 @@ yarn-error.log* *.dev.yml +.vercel