-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
88 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*.*" | ||
|
||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Configure git to use a PAT when cloning | ||
run: | | ||
git config --global url."https://api:${{ secrets.PAT }}@github.com/".insteadOf "https://github.com/" | ||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.19 | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v4 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Upload assets | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: dist | ||
path: 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,24 @@ | ||
universal_binaries: | ||
- replace: true | ||
builds: | ||
- env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- darwin | ||
- windows | ||
- freebsd | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
ignore: | ||
- goos: freebsd | ||
goarch: arm64 | ||
- goos: windows | ||
goarch: arm64 | ||
flags: | ||
- -trimpath | ||
ldflags: | ||
- -s -w -X github.com/kong/deck/cmd.VERSION={{ .Tag }} -X github.com/kong/deck/cmd.COMMIT={{ .ShortCommit }} | ||
snapshot: | ||
name_template: "{{ .Tag }}" |
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,29 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
// VERSION is the current version of decK. | ||
// This should be substituted by git tag during the build process. | ||
var VERSION = "dev" | ||
|
||
// COMMIT is the short hash of the source tree. | ||
// This should be substituted by Git commit hash during the build process. | ||
var COMMIT = "unknown" | ||
|
||
var versionCmd = &cobra.Command{ | ||
Use: "version", | ||
Short: "Print the kceD version", | ||
Long: `The version command prints the version of kceD along with a Git short | ||
commit hash of the source tree.`, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
fmt.Printf("kceD %s (%s) \n", VERSION, COMMIT) | ||
}, | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(versionCmd) | ||
} |