Add .drone.yml for CI/CD
This commit is contained in:
49
.drone.yml
Normal file
49
.drone.yml
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
|
||||||
|
name: build-and-push
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: restore-cache
|
||||||
|
restore_cache:
|
||||||
|
keys:
|
||||||
|
- npm-{{ .Environment.DRONE_REPO_NAME }}-{{ checksum "package.json" }}
|
||||||
|
- npm-{{ .Environment.DRONE_REPO_NAME }}-
|
||||||
|
|
||||||
|
- name: install
|
||||||
|
image: node:18-alpine
|
||||||
|
commands:
|
||||||
|
- npm install
|
||||||
|
cache_from:
|
||||||
|
- npm-{{ .Environment.DRONE_REPO_NAME }}-{{ checksum "package.json" }}
|
||||||
|
|
||||||
|
- name: build
|
||||||
|
image: node:18-alpine
|
||||||
|
commands:
|
||||||
|
- npm run build:h5
|
||||||
|
|
||||||
|
- name: build-image
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
repo: ccr.ccs.tencentyun.com/todo-{{ if eq .Branch "master" }}prod{{ else }}test{{ end }}/todo-frontend
|
||||||
|
tags:
|
||||||
|
- {{ .Commit SHA }}
|
||||||
|
- {{ if eq .Branch "master" }}v1.0.0{{ else }}latest{{ end }}
|
||||||
|
username:
|
||||||
|
from_secret: registry_username
|
||||||
|
password:
|
||||||
|
from_secret: registry_password
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
- dev
|
||||||
|
|
||||||
|
- name: rebuild-cache
|
||||||
|
rebuild_cache:
|
||||||
|
keys:
|
||||||
|
- npm-{{ .Environment.DRONE_REPO_NAME }}-{{ checksum "package.json" }}
|
||||||
|
- npm-{{ .Environment.DRONE_REPO_NAME }}-
|
||||||
Reference in New Issue
Block a user