-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #136 from bavarianbidi/enable_release_build
goreleaser based release build
- Loading branch information
Showing
7 changed files
with
211 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# SPDX-License-Identifier: MIT | ||
|
||
name: release | ||
|
||
on: | ||
push: | ||
# run only against tags | ||
tags: | ||
- 'v*' | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- run: git fetch --force --tags | ||
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | ||
with: | ||
go-version-file: go.mod | ||
|
||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 #v6.0.0 | ||
with: | ||
args: release --clean | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
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 |
---|---|---|
|
@@ -18,3 +18,5 @@ vendor | |
*.dylib | ||
coverage.html | ||
.glide/ | ||
# goreleaser builds | ||
dist/ |
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,70 @@ | ||
# SPDX-License-Identifier: MIT | ||
version: 2 | ||
project_name: auger | ||
before: | ||
hooks: | ||
- go mod tidy | ||
builds: | ||
- id: auger | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
ldflags: | ||
- -s -w | ||
- -X github.com/etcd-id/auger/cmd.appVersion={{.Version}} | ||
- -X github.com/etcd-id/auger/cmd.buildDate={{.Date}} | ||
- -X github.com/etcd-id/auger/cmd.gitCommit={{.Commit}} | ||
main: ./main.go | ||
binary: auger | ||
- id: augerctl | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
ldflags: | ||
- -s -w | ||
- -X github.com/etcd-id/auger/command.appVersion={{.Version}} | ||
- -X github.com/etcd-id/auger/command.buildDate={{.Date}} | ||
- -X github.com/etcd-id/auger/command.gitCommit={{.Commit}} | ||
main: ./augerctl/main.go | ||
binary: augerctl | ||
|
||
archives: | ||
- builds: | ||
- auger | ||
- augerctl | ||
|
||
checksum: | ||
name_template: "checksums.txt" | ||
changelog: | ||
sort: asc | ||
use: github | ||
groups: | ||
- title: "Features" | ||
regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$' | ||
order: 0 | ||
- title: "Bug fixes" | ||
regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$' | ||
order: 1 | ||
- title: "Documentation" | ||
regexp: '^.*?docs(\([[:word:]]+\))??!?:.+$' | ||
order: 2 | ||
- title: "Others" | ||
order: 999 | ||
filters: | ||
exclude: | ||
- "^test:" | ||
release: | ||
github: | ||
owner: etcd-io | ||
name: auger | ||
prerelease: auto |
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,49 @@ | ||
/* | ||
Copyright 2024 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package command | ||
|
||
import ( | ||
"fmt" | ||
"runtime" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
// Version information | ||
var ( | ||
// AppVersion is the version of the application | ||
appVersion = "v0.0.0-dev" | ||
|
||
// BuildTime is the time the application was built | ||
buildDate = "1970-01-01T00:00:00Z" // build date in ISO8601 format | ||
|
||
// GitCommit is the commit hash of the build | ||
gitCommit string | ||
) | ||
|
||
var versionCmd = &cobra.Command{ | ||
Use: "version", | ||
Short: "print current version", | ||
Run: func(_ *cobra.Command, _ []string) { | ||
fmt.Printf("Version:\t%s\n", appVersion) | ||
fmt.Printf("BuildTime:\t%s\n", buildDate) | ||
fmt.Printf("GitCommit:\t%s\n", gitCommit) | ||
fmt.Printf("GoVersion:\t%s\n", runtime.Version()) | ||
fmt.Printf("Compiler:\t%s\n", runtime.Compiler) | ||
fmt.Printf("OS/Arch:\t%s/%s\n", runtime.GOOS, runtime.GOARCH) | ||
}, | ||
} |
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,53 @@ | ||
/* | ||
Copyright 2024 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"runtime" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
// Version information | ||
var ( | ||
// AppVersion is the version of the application | ||
appVersion = "v0.0.0-dev" | ||
|
||
// BuildTime is the time the application was built | ||
buildDate = "1970-01-01T00:00:00Z" // build date in ISO8601 format | ||
|
||
// GitCommit is the commit hash of the build | ||
gitCommit string | ||
) | ||
|
||
var versionCmd = &cobra.Command{ | ||
Use: "version", | ||
Short: "print current version", | ||
Run: func(_ *cobra.Command, _ []string) { | ||
fmt.Printf("Version:\t%s\n", appVersion) | ||
fmt.Printf("BuildTime:\t%s\n", buildDate) | ||
fmt.Printf("GitCommit:\t%s\n", gitCommit) | ||
fmt.Printf("GoVersion:\t%s\n", runtime.Version()) | ||
fmt.Printf("Compiler:\t%s\n", runtime.Compiler) | ||
fmt.Printf("OS/Arch:\t%s/%s\n", runtime.GOOS, runtime.GOARCH) | ||
}, | ||
} | ||
|
||
func init() { | ||
RootCmd.AddCommand(versionCmd) | ||
} |