2021-01-20 15:24:38 +01:00
|
|
|
---
|
|
|
|
kind: pipeline
|
2022-01-07 20:21:30 +01:00
|
|
|
type: docker
|
2021-01-20 15:24:38 +01:00
|
|
|
name: default
|
|
|
|
|
2022-01-07 20:21:30 +01:00
|
|
|
golang-image: &golang-image golang:1.17-alpine
|
|
|
|
|
|
|
|
gobin-volume: &gobin-volume
|
|
|
|
name: gobin
|
|
|
|
path: /go/bin
|
|
|
|
|
|
|
|
usr-volume: &usr-volume
|
|
|
|
name: usr
|
|
|
|
path: /usr
|
|
|
|
|
|
|
|
deps-command: &deps-command apk add build-base git
|
|
|
|
|
2021-01-20 15:24:38 +01:00
|
|
|
steps:
|
2021-01-22 11:27:22 +01:00
|
|
|
- name: tags
|
2021-01-22 11:05:17 +01:00
|
|
|
image: alpine/git
|
2021-01-20 15:24:38 +01:00
|
|
|
commands:
|
|
|
|
- git fetch --tags
|
2021-01-22 11:27:22 +01:00
|
|
|
|
|
|
|
- name: submodules
|
|
|
|
image: alpine/git
|
|
|
|
commands:
|
|
|
|
- git submodule init
|
2021-01-22 11:57:43 +01:00
|
|
|
- git submodule update
|
2021-04-16 14:26:44 +02:00
|
|
|
depends_on:
|
|
|
|
- tags
|
2021-01-21 12:24:32 +01:00
|
|
|
|
2022-01-07 20:21:30 +01:00
|
|
|
- name: install-tools
|
|
|
|
image: *golang-image
|
|
|
|
volumes:
|
|
|
|
- *gobin-volume
|
|
|
|
- *usr-volume
|
|
|
|
commands:
|
|
|
|
- *deps-command
|
|
|
|
- make install-tools
|
|
|
|
|
2021-01-20 15:24:38 +01:00
|
|
|
- name: lint
|
2022-01-07 20:21:30 +01:00
|
|
|
image: *golang-image
|
|
|
|
volumes:
|
|
|
|
- *gobin-volume
|
|
|
|
- *usr-volume
|
2021-01-20 15:24:38 +01:00
|
|
|
commands:
|
|
|
|
- make lint
|
2021-01-21 12:24:32 +01:00
|
|
|
depends_on:
|
2022-01-07 20:21:30 +01:00
|
|
|
- tags
|
2021-04-16 14:26:44 +02:00
|
|
|
- submodules
|
2022-01-07 20:21:30 +01:00
|
|
|
- install-tools
|
2021-01-20 15:24:38 +01:00
|
|
|
|
|
|
|
- name: test
|
2022-01-07 20:21:30 +01:00
|
|
|
image: *golang-image
|
|
|
|
volumes:
|
|
|
|
- *gobin-volume
|
|
|
|
- *usr-volume
|
2021-01-20 15:24:38 +01:00
|
|
|
commands:
|
2021-01-21 12:24:32 +01:00
|
|
|
- make test
|
|
|
|
depends_on:
|
2022-01-07 20:21:30 +01:00
|
|
|
- install-tools
|
|
|
|
- tags
|
|
|
|
- lint
|
2021-04-16 14:25:25 +02:00
|
|
|
- submodules
|
2021-01-20 15:24:38 +01:00
|
|
|
|
|
|
|
- name: build
|
2022-01-07 20:21:30 +01:00
|
|
|
image: *golang-image
|
|
|
|
volumes:
|
|
|
|
- *gobin-volume
|
|
|
|
- *usr-volume
|
2021-01-20 15:24:38 +01:00
|
|
|
commands:
|
|
|
|
- make build
|
|
|
|
depends_on:
|
2021-04-16 14:25:25 +02:00
|
|
|
- lint
|
|
|
|
- test
|
2021-01-25 09:18:46 +01:00
|
|
|
when:
|
|
|
|
event:
|
|
|
|
exclude:
|
2021-01-27 11:07:21 +01:00
|
|
|
- tag
|
2021-01-20 15:24:38 +01:00
|
|
|
|
|
|
|
- name: release
|
2022-01-07 20:21:30 +01:00
|
|
|
image: *golang-image
|
|
|
|
volumes:
|
|
|
|
- *gobin-volume
|
|
|
|
- *usr-volume
|
2021-01-20 15:24:38 +01:00
|
|
|
environment:
|
2021-01-27 10:15:34 +01:00
|
|
|
GITHUB_TOKEN:
|
|
|
|
from_secret: github_token
|
2021-01-20 15:24:38 +01:00
|
|
|
commands:
|
2021-01-21 12:24:32 +01:00
|
|
|
- goreleaser release --rm-dist --parallelism=1
|
2021-01-25 09:18:46 +01:00
|
|
|
depends_on:
|
2021-04-16 14:25:25 +02:00
|
|
|
- lint
|
|
|
|
- test
|
2021-01-25 09:18:46 +01:00
|
|
|
when:
|
|
|
|
event:
|
2021-01-27 11:07:21 +01:00
|
|
|
- tag
|
2022-01-07 20:21:30 +01:00
|
|
|
|
|
|
|
volumes:
|
|
|
|
- name: gobin
|
|
|
|
temp: {}
|
|
|
|
|
|
|
|
- name: usr
|
|
|
|
temp: {}
|