From d066ff420e174da25aab298bd6f843ebd40e2469 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sun, 17 Feb 2019 10:33:38 +0800 Subject: [PATCH] feat: add deploy binary --- .drone.jsonnet | 47 +++++++++++++++++++++++++++++++++++++++++++++++ .drone.yml | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/.drone.jsonnet b/.drone.jsonnet index 21fbff6..042e63d 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -193,6 +193,51 @@ local PipelineBuild(name, os='linux', arch='amd64') = { }, }; +local PipelineRelease = { + kind: 'pipeline', + name: 'release-binary', + platform: { + os: 'linux', + arch: 'amd64', + }, + steps: [ + { + name: 'build-all-binary', + image: 'golang:1.11', + pull: 'always', + environment: { + GO111MODULE: 'on', + }, + commands: [ + 'make release' + ], + when: { + event: [ 'tag' ], + }, + }, + { + name: 'deploy-all-binary', + image: 'plugins/github-release', + pull: 'always', + settings: { + files: [ 'dist/release/*' ], + api_key: { 'from_secret': 'github_release_api_key' }, + }, + when: { + event: [ 'tag' ], + }, + }, + ], + depends_on: [ + 'testing', + ], + trigger: { + ref: [ + 'refs/tags/**', + ], + }, +}; + local PipelineNotifications(os='linux', arch='amd64', depends_on=[]) = { kind: 'pipeline', name: 'notifications', @@ -225,9 +270,11 @@ local PipelineNotifications(os='linux', arch='amd64', depends_on=[]) = { PipelineBuild(name, 'linux', 'amd64'), PipelineBuild(name, 'linux', 'arm64'), PipelineBuild(name, 'linux', 'arm'), + PipelineRelease, PipelineNotifications(depends_on=[ 'linux-amd64', 'linux-arm64', 'linux-arm', + 'release-binary', ]), ] diff --git a/.drone.yml b/.drone.yml index aa0cbc7..3e16faf 100644 --- a/.drone.yml +++ b/.drone.yml @@ -316,6 +316,45 @@ trigger: depends_on: - testing +--- +kind: pipeline +name: release-binary + +platform: + os: linux + arch: amd64 + +steps: +- name: build-all-binary + pull: always + image: golang:1.11 + commands: + - make release + environment: + GO111MODULE: on + when: + event: + - tag + +- name: deploy-all-binary + pull: always + image: plugins/github-release + settings: + api_key: + from_secret: github_release_api_key + files: + - "dist/release/*" + when: + event: + - tag + +trigger: + ref: + - "refs/tags/**" + +depends_on: +- testing + --- kind: pipeline name: notifications @@ -346,5 +385,6 @@ depends_on: - linux-amd64 - linux-arm64 - linux-arm +- release-binary ...