drone-ci-demo/.drone.yml

87 lines
1.4 KiB
YAML
Raw Normal View History

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
group: echo
2021-12-04 15:12:39 +08:00
image: alpine
commands:
- echo hello
- echo world
- echo done
- name: en
group: echo
2021-12-04 15:12:39 +08:00
image: alpine
commands:
- echo hello world
- name: fr
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
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-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:
script:
- echo "deply to staging"
- env
when:
event:
- promote
target:
-production
- name: deploy-production
# image: appleboy/drone-ssh
image: alpine
pull: if-not-exists
settings:
script:
- echo "deply to production"
- env
when:
event:
- promote
target:
- production