From 17c4ed991a023bb5f280d82f6e792e09d71ffb12 Mon Sep 17 00:00:00 2001 From: Fabio Date: Tue, 28 Feb 2023 10:57:07 -0300 Subject: [PATCH] Need to build executable first --- .drone.yml | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 67fbee7..6247c9c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -3,8 +3,41 @@ kind: pipeline name: linux-amd64 type: kubernetes +platform: + os: linux + arch: amd64 + steps: -- name: docker +- name: build-push + pull: always + image: golang:1.16 + commands: + - "go build -v -ldflags '-X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/amd64/drone-packer" + environment: + CGO_ENABLED: 0 + when: + event: + exclude: + - tag + +- name: build-tag + pull: always + image: golang:1.16 + commands: + - "go build -v -ldflags '-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/amd64/drone-packer" + environment: + CGO_ENABLED: 0 + when: + event: + - tag + +- name: executable + pull: always + image: golang:1.16 + commands: + - ./release/linux/amd64/drone-packer --help + +- name: publish image: plugins/docker settings: repo: porto.interlegis.leg.br/library/drone-packer @@ -16,4 +49,14 @@ steps: username: from_secret: porto_user password: - from_secret: porto_pw \ No newline at end of file + from_secret: porto_pw + when: + event: + exclude: + - pull_request + +trigger: + ref: + - refs/heads/master + - "refs/pull/**" + - "refs/tags/**" \ No newline at end of file