-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add vercel deploy in github actions (#75)
* Add vercel deploy in github actions * Fix actions * Use vercel cwd flag * Exec with global cli * Remove cwd for build step * Revert remove cwd from build * Rename production job * Revert useless vercel scripts * Remove cwd notion * Add binaryTargets to prisma * Remove vercel from turbo pipeline * Use generic workflow * Set env in generic workflow
- Loading branch information
Showing
4 changed files
with
89 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: Vercel Production Deployment | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters