Commit 1dfd43b5 authored by ThinhNC's avatar ThinhNC

Merge branch 'staging' into 'develop'

Staging

See merge request !20
parents 39dc4fec d6084364
Pipeline #53077 passed with stage
in 2 minutes and 3 seconds
...@@ -34,9 +34,13 @@ yarn-error.log* ...@@ -34,9 +34,13 @@ yarn-error.log*
.env* .env*
!.env.example !.env.example
# vercel # vercel & build cache
.vercel .vercel
.pnpm-store
# typescript # typescript
*.tsbuildinfo *.tsbuildinfo
next-env.d.ts next-env.d.ts
.vercel
.env*
# GitLab CI/CD Pipeline for deploying Next.js to Vercel using Vercel CLI
# Standard template matching official Vercel documentation:
# https://vercel.com/kb/guide/how-can-i-use-gitlab-pipelines-with-vercel
image: node:20
stages:
- deploy
# 1. Preview Deployment (Tất cả các nhánh tính năng trừ staging, main)
deploy_preview:
stage: deploy
tags:
- runner-builder
except:
- staging
- main
before_script:
- export NVM_DIR="$HOME/.nvm"
- '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"'
- export PATH="$PATH:$HOME/.nvm/versions/node/$(ls $HOME/.nvm/versions/node 2>/dev/null | tail -n 1)/bin:/usr/local/bin:/usr/bin"
- mkdir -p "$HOME/.npm-global"
- npm config set prefix "$HOME/.npm-global"
- export PATH="$HOME/.npm-global/bin:$PATH"
- npm install -g pnpm vercel
script:
- vercel pull --yes --environment=preview --token=$VERCEL_TOKEN
- vercel build --token=$VERCEL_TOKEN
- vercel deploy --prebuilt --token=$VERCEL_TOKEN
variables:
VERCEL_ORG_ID: $VERCEL_ORG_ID
VERCEL_PROJECT_ID: $VERCEL_PROJECT_ID
# 2. Production Deployment (Kích hoạt khi push lên nhánh staging, main)
deploy_production:
stage: deploy
tags:
- runner-builder
only:
- staging
- main
before_script:
- export NVM_DIR="$HOME/.nvm"
- '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"'
- export PATH="$PATH:$HOME/.nvm/versions/node/$(ls $HOME/.nvm/versions/node 2>/dev/null | tail -n 1)/bin:/usr/local/bin:/usr/bin"
- mkdir -p "$HOME/.npm-global"
- npm config set prefix "$HOME/.npm-global"
- export PATH="$HOME/.npm-global/bin:$PATH"
- npm install -g pnpm vercel
script:
- vercel pull --yes --environment=production --token=$VERCEL_TOKEN
- vercel build --prod --token=$VERCEL_TOKEN
- vercel deploy --prebuilt --prod --token=$VERCEL_TOKEN
variables:
VERCEL_ORG_ID: $VERCEL_ORG_ID
VERCEL_PROJECT_ID: $VERCEL_PROJECT_ID
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment