-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use GoReleaser to generate binaries and make releases (#3)
* Use GoReleaser to generate binaries and make releases * .golangci.yml: ignore "gochecknoglobals" linter for internal/version/ * .golangci.yml: ignore "gochecknoinits" linter for internal/version/
- Loading branch information
Showing
7 changed files
with
150 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
project_name: chacha | ||
|
||
before: | ||
hooks: | ||
- go mod download | ||
|
||
builds: | ||
- main: cmd/main.go | ||
ldflags: > | ||
-X github.com/cirruslabs/chacha/internal/version.Version={{.Version}} | ||
-X github.com/cirruslabs/chacha/internal/version.Commit={{.ShortCommit}} | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
|
||
archives: | ||
- id: binary | ||
format: binary | ||
name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}" | ||
- id: regular | ||
name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}" | ||
|
||
release: | ||
prerelease: auto | ||
|
||
brews: | ||
- name: chacha | ||
ids: | ||
- regular | ||
repository: | ||
owner: cirruslabs | ||
name: homebrew-cli | ||
license: FSL-1.1-Apache-2.0 | ||
caveats: See the Github repository for more information | ||
|
||
nfpms: | ||
- package_name: chacha | ||
vendor: Cirrus Labs, Inc. | ||
homepage: https://github.com/cirruslabs/chacha | ||
maintainer: [email protected] | ||
description: Caching proxy for Cirrus Runners | ||
license: FSL-1.1-Apache-2.0 | ||
section: misc | ||
formats: | ||
- deb | ||
- rpm | ||
|
||
furies: | ||
- account: cirruslabs | ||
|
||
notarize: | ||
macos: | ||
- enabled: '{{ isEnvSet "MACOS_SIGN_P12" }}' | ||
sign: | ||
certificate: "{{.Env.MACOS_SIGN_P12}}" | ||
password: "{{.Env.MACOS_SIGN_PASSWORD}}" | ||
notarize: | ||
issuer_id: "{{.Env.MACOS_NOTARY_ISSUER_ID}}" | ||
key_id: "{{.Env.MACOS_NOTARY_KEY_ID}}" | ||
key: "{{.Env.MACOS_NOTARY_KEY}}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package version | ||
|
||
import ( | ||
"fmt" | ||
goversion "github.com/hashicorp/go-version" | ||
"runtime/debug" | ||
) | ||
|
||
var ( | ||
Version = "unknown" | ||
Commit = "unknown" | ||
FullVersion = "" | ||
) | ||
|
||
func init() { | ||
if Version == "unknown" { | ||
info, ok := debug.ReadBuildInfo() | ||
if ok { | ||
// We parse the version here for two reasons: | ||
// * to weed out the "(devel)" version and fallback to "unknown" instead | ||
// (see https://github.com/golang/go/issues/29228 for details on when this might happen) | ||
// * to remove the "v" prefix from the BuildInfo's version (e.g. "v0.7.0") and thus be consistent | ||
// with the binary builds, where the version string would be "0.7.0" instead | ||
semver, err := goversion.NewSemver(info.Main.Version) | ||
if err == nil { | ||
Version = semver.String() | ||
} | ||
} | ||
} | ||
|
||
FullVersion = fmt.Sprintf("%s-%s", Version, Commit) | ||
} |