From 9330af5347bfc2c84fefe552251613a78eca7ff6 Mon Sep 17 00:00:00 2001 From: Joshua Rich Date: Sun, 18 Jul 2021 09:32:18 +1000 Subject: [PATCH] Start using goreleaser. --- .gitignore | 1 + .goreleaser.yml | 69 +++++++++++++++++++++++++++++++++++++++++ go.mod | 11 +++---- go.sum | 31 +++++++++--------- systemd/cf-ddns.service | 2 +- 5 files changed, 91 insertions(+), 23 deletions(-) create mode 100644 .goreleaser.yml diff --git a/.gitignore b/.gitignore index 00a9a05..a6ff691 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ cf-ddns +dist/ diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..f937b6c --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,69 @@ +before: + hooks: + - go mod tidy +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin +archives: + - replacements: + darwin: Darwin + linux: Linux + windows: Windows + 386: i386 + amd64: x86_64 +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ .Tag }}-next" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' +nfpms: + - id: github.com/joshuar/cf-ddns + package_name: cf-ddns + vendor: github.com/joshuar + homepage: https://github.com/joshuar/cf-ddns + maintainer: Josh Rich + description: A Dynamic DNS client for Cloudflare. + license: MIT + release: 1 + + # Replacements for GOOS and GOARCH in the package name. + # Keys should be valid GOOSs or GOARCHs. + # Values are the respective replacements. + # Default is empty. + replacements: + amd64: 64-bit + 386: 32-bit + darwin: macOS + linux: linux + + formats: + - deb + - rpm + + # Section. + section: default + + # Priority. + priority: extra + + # Contents to add to the package. + # GoReleaser will automatically add the binaries. + contents: + # Basic file that applies to all packagers + - src: cf-ddns.yml + dst: /etc/cf-ddns/cf-ddns.yml + type: "config|noreplace" + + # Simple config file + - src: systemd/cf-ddns.service + dst: /usr/lib/systemd/system/cf-ddns.service + type: config diff --git a/go.mod b/go.mod index 00cb400..bb04737 100644 --- a/go.mod +++ b/go.mod @@ -1,13 +1,12 @@ module github.com/joshuar/cf-ddns require ( - github.com/akamensky/argparse v0.0.0-20190115094700-b33e05fb8d69 - github.com/cenkalti/backoff v2.1.1+incompatible - github.com/davecgh/go-spew v1.1.1 - github.com/olebedev/config v0.0.0-20180910155717-57f804269e64 - github.com/sirupsen/logrus v1.3.0 + github.com/akamensky/argparse v1.3.0 + github.com/cenkalti/backoff v2.2.1+incompatible + github.com/olebedev/config v0.0.0-20190528211619-364964f3a8e4 + github.com/sirupsen/logrus v1.8.1 gopkg.in/resty.v1 v1.12.0 - gopkg.in/yaml.v2 v2.2.2 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect ) go 1.13 diff --git a/go.sum b/go.sum index b5e47cd..08ac20d 100644 --- a/go.sum +++ b/go.sum @@ -1,25 +1,24 @@ -github.com/akamensky/argparse v0.0.0-20190115094700-b33e05fb8d69 h1:5LcXlQGiPH1JNsR4IcKpBGNSY/QQdhHUercX+pHP2rU= -github.com/akamensky/argparse v0.0.0-20190115094700-b33e05fb8d69/go.mod h1:pdh+2piXurh466J9tqIqq39/9GO2Y8nZt6Cxzu18T9A= -github.com/cenkalti/backoff v2.1.1+incompatible h1:tKJnvO2kl0zmb/jA5UKAt4VoEVw1qxKWjE/Bpp46npY= -github.com/cenkalti/backoff v2.1.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= +github.com/akamensky/argparse v1.3.0 h1:/y3NFl6Nhw6alHDWoI9tx3vSyrB5zRgs4y9jzHxtjjg= +github.com/akamensky/argparse v1.3.0/go.mod h1:S5kwC7IuDcEr5VeXtGPRVZ5o/FdhcMlQz4IZQuw64xA= +github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= +github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/olebedev/config v0.0.0-20180910155717-57f804269e64 h1:bS1cVBGfBJgWMkgvmyZ1E2uFuKACfsVZLWrfm0qTPc4= -github.com/olebedev/config v0.0.0-20180910155717-57f804269e64/go.mod h1:RL5+WRxWTAXqqCi9i+eZlHrUtO7AQujUqWi+xMohmc4= +github.com/olebedev/config v0.0.0-20190528211619-364964f3a8e4 h1:JnVsYEQzhEcOspy6ngIYNF2u0h2mjkXZptzX0IzZQ4g= +github.com/olebedev/config v0.0.0-20190528211619-364964f3a8e4/go.mod h1:RL5+WRxWTAXqqCi9i+eZlHrUtO7AQujUqWi+xMohmc4= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/sirupsen/logrus v1.3.0 h1:hI/7Q+DtNZ2kINb6qt/lS+IyXnHQe9e90POfeewL/ME= -github.com/sirupsen/logrus v1.3.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= +github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1Nwz0AtPflrblfvUudpo+I= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/net v0.0.0-20181220203305-927f97764cc3 h1:eH6Eip3UpmR+yM/qI9Ijluzb1bNv/cAU/n+6l8tRSis= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 h1:I6FyU15t786LL7oL/hn43zqTuEGr4PN7F4XJ1p4E3Y8= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/resty.v1 v1.12.0 h1:CuXP0Pjfw9rOuY6EP+UvtNvt5DSqHpIxILZKT/quCZI= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= diff --git a/systemd/cf-ddns.service b/systemd/cf-ddns.service index 3f7007a..fb3b7ba 100644 --- a/systemd/cf-ddns.service +++ b/systemd/cf-ddns.service @@ -6,7 +6,7 @@ After=network-online.target [Service] Type=simple -ExecStart=/usr/local/bin/cf-ddns -c /etc/cf-ddns.yml +ExecStart=/usr/local/bin/cf-ddns -c /etc/cf-ddns/cf-ddns.yml ProtectSystem=strict ProtectHome=yes