Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vercel deploy in github actions #75

Merged
merged 13 commits into from
Nov 29, 2023
59 changes: 59 additions & 0 deletions .github/workflows/vercel-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Vercel deploy
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}

on:
workflow_call:
inputs:
environment:
required: true
type: string
extra_args:
required: false
type: string

jobs:
Deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install Dependencies
run: yarn install

- name: Install Vercel CLI
run: npm install --global vercel@latest

- name: Pull Vercel Environment Information (Docs)
run: vercel pull --yes --environment=${{ inputs.environment }} --token=${{ secrets.VERCEL_TOKEN }}
env:
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_DOCS }}
- name: Build Project Artifacts (Docs)
run: vercel build ${{ inputs.extra_args }} --token=${{ secrets.VERCEL_TOKEN }}
env:
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_DOCS }}
- name: Deploy Project Artifacts to Vercel (Docs)
run: vercel deploy ${{ inputs.extra_args }} --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
env:
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_DOCS }}

- name: Intermediate cleanup
run: rm -rf .vercel

- name: Pull Vercel Environment Information (Example)
run: vercel pull --yes --environment=${{ inputs.environment }} --token=${{ secrets.VERCEL_TOKEN }}
env:
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_EXAMPLE }}
- name: Build Project Artifacts (Example)
run: vercel build ${{ inputs.extra_args }} --token=${{ secrets.VERCEL_TOKEN }}
env:
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_EXAMPLE }}
- name: Deploy Project Artifacts to Vercel (Example)
run: vercel deploy ${{ inputs.extra_args }} --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
env:
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_EXAMPLE }}
12 changes: 12 additions & 0 deletions .github/workflows/vercel-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Vercel Preview Deployment

on:
push:
branches-ignore:
- main
jobs:
Deploy-Preview:
uses: ./.github/workflows/vercel-deploy.yml
secrets: inherit
with:
environment: preview
16 changes: 16 additions & 0 deletions .github/workflows/vercel-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Vercel Production Deployment
foyarash marked this conversation as resolved.
Show resolved Hide resolved

on:
pull_request:
types:
- closed
branches:
- "main"
jobs:
Deploy-Production:
if: startsWith(github.head_ref, 'changeset-release/') && github.event.pull_request.merged == true
uses: ./.github/workflows/vercel-deploy.yml
secrets: inherit
with:
environment: production
extra_args: --prod
3 changes: 2 additions & 1 deletion apps/example/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
// learn more about it in the docs: https://pris.ly/d/prisma-schema

generator client {
provider = "prisma-client-js"
provider = "prisma-client-js"
binaryTargets = ["native", "rhel-openssl-1.0.x"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
binaryTargets = ["native", "rhel-openssl-1.0.x"]
binaryTargets = ["native", "rhel-openssl-1.0.x"]

Why this modification ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had an issue related to build being done on a different environment than vercel

Query engine library for current platform "rhel-openssl-1.1.x" could not be found.

}

generator jsonSchema {
Expand Down
Loading