Skip to content

Commit

Permalink
Merge pull request #63 from Taka1304/ci/vercel
Browse files Browse the repository at this point in the history
add: vercel deployment ci
  • Loading branch information
Taka1304 authored Oct 20, 2024
2 parents ae5df9e + a030990 commit 75cf1b0
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 3 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/vercel_dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Deploy to Vercel Dev

env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}

on:
pull_request:
# 手動設定
workflow_dispatch:
inputs:
ref:
description: branch|tag|SHA to checkout
default: 'main'
required: true
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: preview
url: ${{ steps.deploy.outputs.url }}
steps:
- uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 20
check-latest: true

- name: Install Vercel CLI
run: npm install --global vercel@latest pnpm@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
id: deploy
run: echo "url=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }})" >> $GITHUB_OUTPUT
42 changes: 42 additions & 0 deletions .github/workflows/vercel_prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: deploy production

env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}

on:
push:
branches: ['main']
workflow_dispatch:
inputs:
ref:
description: branch|tag|SHA to checkout
default: 'main'
required: true
jobs:
build:
runs-on: ubuntu-latest
environment:
name: preview
url: ${{ steps.deploy.outputs.url }}
steps:
- uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 20
check-latest: true

- name: Install Vercel CLI
run: npm install --global vercel@latest pnpm@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 --prod --prebuilt --token=${{ secrets.VERCEL_TOKEN }}

4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,5 @@
"tailwindcss": "^3.4.3",
"typescript": "^5.0.2"
},
"volta": {
"node": "20.11.1"
}
"packageManager": "[email protected]+sha512.22721b3a11f81661ae1ec68ce1a7b879425a1ca5b991c975b074ac220b187ce56c708fe5db69f4c962c989452eee76c82877f4ee80f474cebd61ee13461b6228"
}

0 comments on commit 75cf1b0

Please sign in to comment.