From 6b4461576569cb6f60ab6b5633adc3d24f08d958 Mon Sep 17 00:00:00 2001 From: Gustavo Chain Date: Thu, 17 Oct 2019 10:48:43 +0200 Subject: [PATCH 1/7] add goreleaser step --- .drone.jsonnet | 12 +++++++++++- .drone.yml | 13 ++++++++++++- packages/go-kosu/.goreleaser.yml | 8 ++++---- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index e28fc939c..33e9164d3 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -99,7 +99,17 @@ local KosuGeth(name) = Image(name, "kosu-test-geth:latest") { "NPM_PASS": { "from_secret": "npm_password" }, }, - } + }, + Image("gorelease", "go-kosu") { + "commands": [ + "git fetch --tags", + "cd ./packages/go-kosu", + "curl -sL https://git.io/goreleaser | bash" + ], + "environment": { + "GITHUB_TOKEN": { "from_secret": "github_token" }, + } + } ], "depends_on": [ "tests" diff --git a/.drone.yml b/.drone.yml index 919333260..26fb34534 100644 --- a/.drone.yml +++ b/.drone.yml @@ -92,7 +92,7 @@ steps: image: gcr.io/kosu-io/go-kosu-ci:latest commands: - cd packages/go-kosu - - "export KOSU_TEST_NODES=$(pwd)/testnet/node0@kosu-node-1:26657,$(pwd)/testnet/node1@kosu-node-1:26657,$(pwd)/testnet/node2@kosu-node-1:26657,$(pwd)/testnet/node3@kosu-node-1:26657" + - export KOSU_TEST_NODES=$(pwd)/testnet/node0@kosu-node-1:26657,$(pwd)/testnet/node1@kosu-node-1:26657,$(pwd)/testnet/node2@kosu-node-1:26657,$(pwd)/testnet/node3@kosu-node-1:26657 - make ci depends_on: - build-project @@ -153,6 +153,17 @@ steps: status: - success +- name: gorelease + pull: always + image: gcr.io/kosu-io/go-kosu + commands: + - git fetch --tags + - cd ./packages/go-kosu + - curl -sL https://git.io/goreleaser | bash + environment: + GITHUB_TOKEN: + from_secret: github_token + trigger: event: - tag diff --git a/packages/go-kosu/.goreleaser.yml b/packages/go-kosu/.goreleaser.yml index 43719ffe5..085089ffb 100644 --- a/packages/go-kosu/.goreleaser.yml +++ b/packages/go-kosu/.goreleaser.yml @@ -1,19 +1,19 @@ project_name: kosu builds: - - binary: kosud + - id: kosud + binary: kosud main: ./cmd/kosud/main.go goos: - linux - - darwin goarch: - amd64 - - binary: kosu-cli + - id: kosu-cli + binary: kosu-cli main: ./cmd/kosu-cli/main.go goos: - linux - - darwin goarch: - amd64 From daab1f75551300559a30631bc3fd2319572f5d92 Mon Sep 17 00:00:00 2001 From: Gustavo Chain Date: Thu, 17 Oct 2019 11:25:01 +0200 Subject: [PATCH 2/7] go-kosu: remove ./dist --- packages/go-kosu/dist/config.yaml | 132 ------------------------------ 1 file changed, 132 deletions(-) delete mode 100644 packages/go-kosu/dist/config.yaml diff --git a/packages/go-kosu/dist/config.yaml b/packages/go-kosu/dist/config.yaml deleted file mode 100644 index 91dfb916d..000000000 --- a/packages/go-kosu/dist/config.yaml +++ /dev/null @@ -1,132 +0,0 @@ -project_name: kosu -release: - github: - owner: ParadigmFoundation - name: kosu-monorepo - name_template: '{{.Tag}}' -brews: -- name: kosu - commit_author: - name: goreleaserbot - email: goreleaser@carlosbecker.com - install: |- - bin.install "kosud" - bin.install "kosu-cli" -scoop: - name: kosu - commit_author: - name: goreleaserbot - email: goreleaser@carlosbecker.com - url_template: https://github.com/ParadigmFoundation/kosu-monorepo/releases/download/{{ - .Tag }}/{{ .ArtifactName }} -builds: -- id: kosud - goos: - - linux - - darwin - goarch: - - amd64 - goarm: - - "6" - targets: - - linux_amd64 - - darwin_amd64 - main: ./cmd/kosud/main.go - ldflags: - - -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} - -X main.builtBy=goreleaser - binary: kosud - lang: go -- id: kosu-cli - goos: - - linux - - darwin - goarch: - - amd64 - goarm: - - "6" - targets: - - linux_amd64 - - darwin_amd64 - main: ./cmd/kosu-cli/main.go - ldflags: - - -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} - -X main.builtBy=goreleaser - binary: kosu-cli - lang: go -archives: -- id: kosud - builds: - - kosud - - kosu-cli - name_template: '{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ - .Arm }}{{ end }}' - replacements: - amd64: x86_64 - format: binary - files: - - licence* - - LICENCE* - - license* - - LICENSE* - - readme* - - README* - - changelog* - - CHANGELOG* -- id: kosu-cli - builds: - - kosud - - kosu-cli - name_template: '{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ - .Arm }}{{ end }}' - replacements: - amd64: x86_64 - format: binary - files: - - licence* - - LICENCE* - - license* - - LICENSE* - - readme* - - README* - - changelog* - - CHANGELOG* -nfpms: -- name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm - }}v{{ .Arm }}{{ end }}' - id: default - builds: - - kosud - - kosu-cli - bindir: /usr/local/bin -snapcrafts: -- name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm - }}v{{ .Arm }}{{ end }}' - builds: - - kosud - - kosu-cli -snapshot: - name_template: SNAPSHOT-{{ .ShortCommit }} -checksum: - name_template: checksums.txt - algorithm: sha256 -changelog: - filters: - exclude: - - '^docs:' - - '^test:' - sort: asc -dist: dist -sign: - cmd: gpg - args: - - --output - - $signature - - --detach-sig - - $artifact - signature: ${artifact}.sig - artifacts: none -env_files: - github_token: ~/.config/goreleaser/github_token -github_urls: - download: https://github.com From 64247b3eacccdcd68e7e7956bedaa2b92bed152e Mon Sep 17 00:00:00 2001 From: Gustavo Chain Date: Thu, 17 Oct 2019 12:54:11 +0200 Subject: [PATCH 3/7] go-kosu: simplify .goreleaser.yml --- packages/go-kosu/.goreleaser.yml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/packages/go-kosu/.goreleaser.yml b/packages/go-kosu/.goreleaser.yml index 085089ffb..90def81b6 100644 --- a/packages/go-kosu/.goreleaser.yml +++ b/packages/go-kosu/.goreleaser.yml @@ -17,22 +17,5 @@ builds: goarch: - amd64 -archives: - - id: kosud - replacements: - amd64: x86_64 - format: binary - - - id: kosu-cli - replacements: - amd64: x86_64 - format: binary - checksum: name_template: 'checksums.txt' -changelog: - sort: asc - filters: - exclude: - - '^docs:' - - '^test:' From 404c084b3082c6189f051b9a8af8f8999e8ea5ad Mon Sep 17 00:00:00 2001 From: Gustavo Chain Date: Thu, 17 Oct 2019 15:53:08 +0200 Subject: [PATCH 4/7] go-kosu: use ldflags to pass version --- packages/go-kosu/.goreleaser.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/go-kosu/.goreleaser.yml b/packages/go-kosu/.goreleaser.yml index 90def81b6..20d22a765 100644 --- a/packages/go-kosu/.goreleaser.yml +++ b/packages/go-kosu/.goreleaser.yml @@ -4,6 +4,10 @@ builds: - id: kosud binary: kosud main: ./cmd/kosud/main.go + ldflags: &ldflags + - -s -w -X github.com/ParadigmFoundation/kosu-monorepo/packages/go-kosu/version.Version={{.Version}} + - -X github.com/ParadigmFoundation/kosu-monorepo/packages/go-kosu/version.GitCommit={{.ShortCommit}} + goos: - linux goarch: @@ -12,6 +16,7 @@ builds: - id: kosu-cli binary: kosu-cli main: ./cmd/kosu-cli/main.go + ldflags: *ldflags goos: - linux goarch: From afeeb936910daaff96a39e3eab124cd2180e735e Mon Sep 17 00:00:00 2001 From: Gustavo Chain Date: Tue, 22 Oct 2019 17:19:00 +0200 Subject: [PATCH 5/7] go-releaser acts when go-kosu tag is set --- .drone.jsonnet | 5 +++++ .drone.yml | 3 +++ 2 files changed, 8 insertions(+) diff --git a/.drone.jsonnet b/.drone.jsonnet index a2d336530..bba950c9a 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -108,6 +108,11 @@ local KosuGeth(name) = Image(name, "kosu-test-geth:latest") { ], "environment": { "GITHUB_TOKEN": { "from_secret": "github_token" }, + }, + "when": { + "ref": { + "include": ["refs/tags/@kosu/go-kosu*"] + } } } ], diff --git a/.drone.yml b/.drone.yml index 327cfb6a3..90ebdc68d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -164,6 +164,9 @@ steps: environment: GITHUB_TOKEN: from_secret: github_token + when: + ref: + - refs/tags/@kosu/go-kosu* trigger: event: From 742fc4db8e313a5b51e13fed913206731e6c705b Mon Sep 17 00:00:00 2001 From: Gustavo Chain Date: Tue, 22 Oct 2019 17:48:26 +0200 Subject: [PATCH 6/7] go-releaser skip tag validations --- .drone.jsonnet | 2 +- .drone.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index bba950c9a..4f883ce74 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -104,7 +104,7 @@ local KosuGeth(name) = Image(name, "kosu-test-geth:latest") { "commands": [ "git fetch --tags", "cd ./packages/go-kosu", - "curl -sL https://git.io/goreleaser | bash" + "curl -sL https://git.io/goreleaser | bash -s -- --skip-validate" ], "environment": { "GITHUB_TOKEN": { "from_secret": "github_token" }, diff --git a/.drone.yml b/.drone.yml index 90ebdc68d..e2fe14b87 100644 --- a/.drone.yml +++ b/.drone.yml @@ -160,7 +160,7 @@ steps: commands: - git fetch --tags - cd ./packages/go-kosu - - curl -sL https://git.io/goreleaser | bash + - curl -sL https://git.io/goreleaser | bash -s -- --skip-validate environment: GITHUB_TOKEN: from_secret: github_token From d3de70eaf104f3557ccce009ef6e85dc0d093eef Mon Sep 17 00:00:00 2001 From: Gustavo Chain Date: Tue, 22 Oct 2019 19:06:00 +0200 Subject: [PATCH 7/7] go-releaser archive name_template --- packages/go-kosu/.goreleaser.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/go-kosu/.goreleaser.yml b/packages/go-kosu/.goreleaser.yml index 20d22a765..1ca68ac14 100644 --- a/packages/go-kosu/.goreleaser.yml +++ b/packages/go-kosu/.goreleaser.yml @@ -22,5 +22,9 @@ builds: goarch: - amd64 +archives: + - id: kosu + name_template: "{{ .ProjectName }}-{{ .Os }}" + checksum: name_template: 'checksums.txt'