Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use go releaser to publish binaries on new tags #498

Merged
merged 2 commits into from
Dec 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
63 changes: 44 additions & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,38 @@
version: 2
version: 2.1
workflows:
pr_acceptance:
jobs:
- test
- build
build_accept_deploy:
jobs:
- test
- build
- package:
requires:
- build
- deploy:
requires:
- test
- build
- package
publish_release:
jobs:
- test:
filters:
branches:
ignore: /.*/
tags:
only: /v[0-9]+(\.[0-9]+)*(-.*)*/
- github_binaries:
requires:
- test
filters:
branches:
ignore: /.*/
tags:
only: /v[0-9]+(\.[0-9]+)*(-.*)*/
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to repeat the filtering in both jobs because there is no way to filter an entire workflow


jobs:
test:
working_directory: /home/circleci/go/src/github.com/grafana/carbon-relay-ng
Expand Down Expand Up @@ -96,21 +130,12 @@ jobs:

docker push grafana/carbon-relay-ng:$tag
fi
workflows:
version: 2
pr_acceptance:
jobs:
- test
- build
build_accept_deploy:
jobs:
- test
- build
- package:
requires:
- build
- deploy:
requires:
- test
- build
- package

github_binaries:
docker:
- image: cimg/go:1.18
steps:
- checkout
- run: curl -sfL https://goreleaser.com/static/run | bash
# For dry runs use the following and comment the above
# - run: curl -sfL https://goreleaser.com/static/run | bash -s -- --rm-dist --skip-publish --snapshot
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took me a few minutes to find out how to do a dry run so I think this comment adds value for future us if we run into any issue

25 changes: 25 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
builds:
- id: "carbon-relay-ng"
main: ./cmd/carbon-relay-ng
binary: carbon-relay-ng
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

amd64 only arch supported today because we ran into issues when compiling to arm due to our metrictank dependency

archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
skip: true
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
github.com/gorilla/handlers v1.4.0
github.com/gorilla/mux v0.0.0-20140624184626-14cafe285133
github.com/grafana/configparser v0.0.0-20210707122942-2593eb86a3ee
github.com/grafana/metrictank v1.0.1-0.20210114150051-52835b9a8775
github.com/grafana/metrictank v1.0.1-0.20221128152741-61182cf5f40e
github.com/jpillora/backoff v0.0.0-20160414055204-0496a6c14df0
github.com/kisielk/og-rek v0.0.0-20170405223746-ec792bc6e6aa
github.com/metrics20/go-metrics20 v0.0.0-20180821133656-717ed3a27bf9
Expand Down Expand Up @@ -61,7 +61,7 @@ require (
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 // indirect
golang.org/x/oauth2 v0.0.0-20180118004544-b28fcf2b08a1 // indirect
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 // indirect
golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e // indirect
golang.org/x/sys v0.3.0 // indirect
golang.org/x/text v0.3.1-0.20171227012246-e19ae1496984 // indirect
google.golang.org/api v0.0.0-20180122000316-bc96e9251952 // indirect
google.golang.org/appengine v1.0.1-0.20170921170648-24e4144ec923 // indirect
Expand Down
7 changes: 4 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ github.com/gorilla/mux v0.0.0-20140624184626-14cafe285133 h1:ukbzVQxXffKnAteyOe2
github.com/gorilla/mux v0.0.0-20140624184626-14cafe285133/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/grafana/configparser v0.0.0-20210707122942-2593eb86a3ee h1:5j5kbjPdpun9I6taPXXvQnjUYaHxHg4Akgrh9JGB+4k=
github.com/grafana/configparser v0.0.0-20210707122942-2593eb86a3ee/go.mod h1:5kq854/YXuu4gJm0A2hON7r5IeAKTpap20ARcCZSugw=
github.com/grafana/metrictank v1.0.1-0.20210114150051-52835b9a8775 h1:5DryQe90TlOk9FiaS2fAShAQAkzy4OlSs0DS1LQU9rI=
github.com/grafana/metrictank v1.0.1-0.20210114150051-52835b9a8775/go.mod h1:+W7kcYMB3XFMCQdmZSrXvqb8KCE84tQMaijapcRbptE=
github.com/grafana/metrictank v1.0.1-0.20221128152741-61182cf5f40e h1:Nv6VFe2R0OZRRTJzLqTno+mPL9VNat8zLUE1zzSUDko=
github.com/grafana/metrictank v1.0.1-0.20221128152741-61182cf5f40e/go.mod h1:+W7kcYMB3XFMCQdmZSrXvqb8KCE84tQMaijapcRbptE=
github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE=
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/jcmturner/gofork v0.0.0-20190328161633-dc7c13fece03 h1:FUwcHNlEqkqLjLBdCp5PRlCFijNjvcYANOZXzCfXwCM=
Expand Down Expand Up @@ -128,8 +128,9 @@ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FY
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e h1:nFYrTHrdrAOpShe27kaFHjsqYSEQ0KWqdWLu3xuZJts=
golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ=
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20171227012246-e19ae1496984 h1:4S3Dic2vY09agWhKAjYa6buMB7HsLkVrliEHZclmmSU=
golang.org/x/text v0.3.1-0.20171227012246-e19ae1496984/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down