Files
todo-frontend/.drone.yml
2026-03-21 14:35:00 +00:00

109 lines
2.3 KiB
YAML

kind: pipeline
type: kubernetes
name: build-and-deploy-dev
clone:
disable: true
trigger:
event:
- push
branch:
- dev
steps:
- name: dev-clone
image: ccr.ccs.tencentyun.com/violin/git-alpine:latest
settings:
username:
from_secret: git_username
password:
from_secret: git_password
- name: dev-install
image: node:18-alpine
commands:
- npm install
- name: dev-build
image: node:18-alpine
commands:
- npm run build:h5
- name: dev-build-image
image: ccr.ccs.tencentyun.com/violin/docker:linux-amd64
settings:
repo: ccr.ccs.tencentyun.com/violin/todo-frontend
tags:
- ${DRONE_COMMIT_SHA}
- latest
username:
from_secret: registry_username
password:
from_secret: registry_password
- name: dev-deploy
image: ccr.ccs.tencentyun.com/violin/kubectl:latest
commands:
- kubectl set image deployment/todo-frontend todo-frontend=ccr.ccs.tencentyun.com/violin/todo-frontend:${DRONE_COMMIT_SHA} -n drone
- kubectl rollout status deployment/todo-frontend -n drone
environment:
KUBECONFIG:
from_secret: kubeconfig
---
kind: pipeline
type: kubernetes
name: build-and-deploy-prod
clone:
disable: true
trigger:
event:
- push
branch:
- master
steps:
- name: prod-clone
image: ccr.ccs.tencentyun.com/violin/git-alpine:latest
settings:
username:
from_secret: git_username
password:
from_secret: git_password
- name: prod-install
image: node:18-alpine
commands:
- npm install
- name: prod-build
image: node:18-alpine
commands:
- npm run build:h5
- name: prod-build-image
image: ccr.ccs.tencentyun.com/violin/docker:linux-amd64
settings:
repo: ccr.ccs.tencentyun.com/violin/todo-frontend
tags:
- ${DRONE_COMMIT_SHA}
- v1.0.0
username:
from_secret: registry_username
password:
from_secret: registry_password
- name: prod-deploy
image: ccr.ccs.tencentyun.com/violin/kubectl:latest
commands:
- kubectl set image deployment/todo-frontend todo-frontend=ccr.ccs.tencentyun.com/violin/todo-frontend:${DRONE_COMMIT_SHA} -n drone
- kubectl rollout status deployment/todo-frontend -n drone
environment:
KUBECONFIG:
from_secret: kubeconfig