-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
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,54 @@ | ||
name: Build and Deploy packages/example | ||
env: | ||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | ||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: pnpm/action-setup@v4 | ||
name: Install pnpm | ||
with: | ||
version: 8.6.1 | ||
run_install: false | ||
- name: Install Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
cache: 'pnpm' | ||
- name: Install node_modules | ||
run: pnpm install | ||
- name: Install Vercel CLI | ||
run: npm install -g vercel@35 | ||
- name: Link Vercel project | ||
run: vercel link --yes --token ${{ secrets.VERCEL_TOKEN }} | ||
|
||
# Preview deployment (for pull requests and non-main pushes) | ||
- name: Pull Vercel environment information (Preview) | ||
if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref != 'refs/heads/main') | ||
run: vercel pull --yes --environment=preview --token ${{ secrets.VERCEL_TOKEN }} | ||
- name: Build project artifacts (Preview) | ||
if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref != 'refs/heads/main') | ||
run: vercel build --token ${{ secrets.VERCEL_TOKEN }} | ||
- name: Deploy to Vercel (Preview) | ||
if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref != 'refs/heads/main') | ||
run: vercel deploy --prebuilt --token ${{ secrets.VERCEL_TOKEN }} | ||
|
||
# Production deployment (for main branch pushes) | ||
- name: Pull Vercel environment information (Production) | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
run: vercel pull --yes --environment=production --token ${{ secrets.VERCEL_TOKEN }} | ||
- name: Build project artifacts (Production) | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
run: vercel build --prod --token ${{ secrets.VERCEL_TOKEN }} | ||
- name: Deploy to Vercel (Production) | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
run: vercel deploy --prebuilt --prod --token ${{ secrets.VERCEL_TOKEN }} |