2021-12-04 14:57:01 +08:00
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: default
|
|
|
|
|
|
|
|
steps:
|
2021-12-04 15:12:39 +08:00
|
|
|
- name: greeting
|
2021-12-05 16:37:44 +08:00
|
|
|
group: echo
|
2021-12-04 15:12:39 +08:00
|
|
|
image: alpine
|
|
|
|
commands:
|
|
|
|
- echo hello
|
|
|
|
- echo world
|
|
|
|
- echo done
|
|
|
|
|
|
|
|
- name: en
|
2021-12-05 16:37:44 +08:00
|
|
|
group: echo
|
2021-12-04 15:12:39 +08:00
|
|
|
image: alpine
|
|
|
|
commands:
|
|
|
|
- echo hello world
|
|
|
|
|
|
|
|
- name: fr
|
2021-12-05 16:37:44 +08:00
|
|
|
group: echo
|
2021-12-04 15:12:39 +08:00
|
|
|
image: alpine
|
|
|
|
commands:
|
|
|
|
- echo bonjour monde
|
2021-12-04 15:06:41 +08:00
|
|
|
|
2021-12-05 01:21:24 +08:00
|
|
|
- name: build
|
|
|
|
image: golang:1.17-alpine
|
|
|
|
pull: if-not-exists
|
2021-12-05 16:37:44 +08:00
|
|
|
environment:
|
|
|
|
CGO_ENABLED: 0
|
|
|
|
GOOS: linux
|
|
|
|
GOARCH: amd64
|
2021-12-05 01:21:24 +08:00
|
|
|
commands:
|
2021-12-05 16:39:18 +08:00
|
|
|
- env
|
2021-12-05 03:26:10 +08:00
|
|
|
- go build -ldflags="-s -w" -tags timetzdata -o app main.go
|
2021-12-05 01:21:24 +08:00
|
|
|
|
2021-12-05 03:26:10 +08:00
|
|
|
- name: publish
|
2021-12-05 00:41:44 +08:00
|
|
|
image: plugins/docker
|
2021-12-11 17:43:00 +08:00
|
|
|
pull: if-not-exists
|
2021-12-05 01:03:06 +08:00
|
|
|
settings:
|
|
|
|
repo: esinio/helloworld
|
|
|
|
username:
|
|
|
|
from_secret: docker_username
|
|
|
|
password:
|
|
|
|
from_secret: docker_password
|
2021-12-05 00:41:44 +08:00
|
|
|
|
2021-12-04 15:06:41 +08:00
|
|
|
trigger:
|
2021-12-04 16:04:27 +08:00
|
|
|
branch:
|
|
|
|
- master
|
2021-12-04 15:06:41 +08:00
|
|
|
event:
|
2021-12-04 15:12:39 +08:00
|
|
|
- push
|
2021-12-11 17:15:20 +08:00
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: deploy
|
|
|
|
|
|
|
|
# drone-ssh doc
|
|
|
|
# http://plugins.drone.io/appleboy/drone-ssh/
|
|
|
|
steps:
|
|
|
|
- name: deploy-staging
|
|
|
|
# image: appleboy/drone-ssh
|
|
|
|
image: alpine
|
|
|
|
pull: if-not-exists
|
|
|
|
settings:
|
2021-12-11 17:26:29 +08:00
|
|
|
commands:
|
2021-12-11 17:15:20 +08:00
|
|
|
- echo "deply to staging"
|
|
|
|
- env
|
|
|
|
when:
|
|
|
|
event:
|
|
|
|
- promote
|
|
|
|
target:
|
2021-12-11 17:30:36 +08:00
|
|
|
- staging
|
2021-12-11 17:15:20 +08:00
|
|
|
|
|
|
|
- name: deploy-production
|
|
|
|
# image: appleboy/drone-ssh
|
|
|
|
image: alpine
|
|
|
|
pull: if-not-exists
|
|
|
|
settings:
|
2021-12-11 17:26:29 +08:00
|
|
|
commands:
|
2021-12-11 17:15:20 +08:00
|
|
|
- echo "deply to production"
|
|
|
|
- env
|
2021-12-11 17:33:03 +08:00
|
|
|
- echo "deply completed"
|
2021-12-11 17:15:20 +08:00
|
|
|
when:
|
|
|
|
event:
|
|
|
|
- promote
|
|
|
|
target:
|
|
|
|
- production
|