prepare for release

- making use of `goreleaser`, we can make building for all platforms
easy peasy, leveraging go's ability to create reproducible builds given
a set of flags that we can have under in a declarative fashion under
`goreleaser.yaml`

Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
This commit is contained in:
Ciro S. Costa 2021-07-10 22:34:32 -04:00
parent edb7e1b79f
commit 2688c54929
3 changed files with 53 additions and 0 deletions

1
.gitignore vendored
View file

@ -2,3 +2,4 @@
*.bin
*.mmdb
*.csv
dist/

38
.goreleaser.yml Normal file
View file

@ -0,0 +1,38 @@
builds:
- binary: monero
main: ./cmd/monero
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
tags:
- osusergo
- netgo
- static_build
flags:
- -trimpath
ldflags:
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
mod_timestamp: '{{ .CommitTimestamp }}'
goarch:
- amd64
- arm
- arm64
goarm:
- 6
- 7
archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
amd64: x86_64
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"

View file

@ -11,15 +11,29 @@ import (
"github.com/cirocosta/go-monero/cmd/monero/commands/wallet"
)
var (
version = "dev"
commit = "dev"
)
var rootCmd = &cobra.Command{
Use: "monero",
Short: "Daemon, Wallet, and p2p command line monero CLI",
}
var versionCmd = &cobra.Command{
Use: "version",
Short: "print the version of this cli",
Run: func(_ *cobra.Command, _ []string) {
fmt.Println(version, commit)
},
}
func init() {
rootCmd.AddCommand(daemon.RootCommand)
rootCmd.AddCommand(wallet.RootCommand)
rootCmd.AddCommand(p2p.RootCommand)
rootCmd.AddCommand(versionCmd)
}
func main() {