99 lines
2.1 KiB
YAML
99 lines
2.1 KiB
YAML
kind: pipeline
|
|
type: kubernetes
|
|
|
|
name: build-and-deploy-dev
|
|
|
|
trigger:
|
|
event:
|
|
- push
|
|
branch:
|
|
- dev
|
|
|
|
environment:
|
|
DRONE_GIT_USERNAME:
|
|
from_secret: drone_git_username
|
|
DRONE_GIT_PASSWORD:
|
|
from_secret: drone_git_password
|
|
|
|
steps:
|
|
- name: install
|
|
image: node:18-alpine
|
|
commands:
|
|
- npm install
|
|
|
|
- name: build
|
|
image: node:18-alpine
|
|
commands:
|
|
- npm run build:h5
|
|
|
|
- name: 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: deploy-to-k8s
|
|
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
|
|
|
|
trigger:
|
|
event:
|
|
- push
|
|
branch:
|
|
- master
|
|
|
|
environment:
|
|
DRONE_GIT_USERNAME:
|
|
from_secret: drone_git_username
|
|
DRONE_GIT_PASSWORD:
|
|
from_secret: drone_git_password
|
|
|
|
steps:
|
|
- name: install
|
|
image: node:18-alpine
|
|
commands:
|
|
- npm install
|
|
|
|
- name: build
|
|
image: node:18-alpine
|
|
commands:
|
|
- npm run build:h5
|
|
|
|
- name: 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: deploy-to-k8s
|
|
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
|