代码拉取完成,页面将自动刷新
kind: pipeline
type: docker
name: default
steps:
- name: 编译
image: golang:1.16.5-alpine
pull: if-not-exists
volumes:
- name: cache_golang_mod
path: /go/pkg/mod
environment:
GOPROXY: https://goproxy.io,direct
commands:
- CGO_ENABLED=0 GOOS=linux go build -mod=mod -a -installsuffix cgo -o main .
- name: 构建镜像
image: plugins/docker
pull: if-not-exists
settings:
mirror: https://onmbochl.mirror.aliyuncs.com # 我自己的加速地址
purge: false
username:
from_secret: docker_user # 在 drone 的 secret 里面设置的变量
password:
from_secret: docker_pass # 在 drone 的 secret 里面设置的变量
registry: registry.cn-shenzhen.aliyuncs.com
repo: registry.cn-shenzhen.aliyuncs.com/auto_publish/gdshop-admin-go-api
#tags: ${DRONE_TAG=latest}
#auto_tag: true
insecure: true
# debug: true
# use_cache: true
tags:
- 'test-latest'
- name: 触发部署
image: plugins/webhook
settings:
urls:
from_secret: webhook_url
debug: true
when: # 本步骤执行条件
branch: # 根据分支 为 test的才执行
- test
trigger:
branch:
- test
volumes:
- name: cache_golang_mod
host:
path: /tmp/cache/golang-mod # 必须先建好目录
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。