Files
todo-frontend/.drone.yml
2026-03-20 14:23:44 +00:00

50 lines
1.1 KiB
YAML

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 }}-