diff --git a/Makefile b/Makefile index b125ae4..2843e3c 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ include $(PWD)/src/toolchain/Makefile +VERSION ?= $(shell git describe --tag --always --dirty --match 'v[0-9]*' --abbrev=8) + KEYS := \ 6B61ECD76088748C70590D55E90A401336C8AAA9 \ A8864A8303994E3A18ACD1760CAB4418C834B102 \ @@ -16,7 +18,6 @@ LOCAL_BUILD_DIR := 'build' .PHONY: default default: \ toolchain \ - version \ $(DEFAULT_GOAL) \ $(patsubst %,$(KEY_DIR)/%.asc,$(KEYS)) \ $(OUT_DIR)/turnkey.linux-x86_64 \ @@ -43,12 +44,6 @@ test: $(OUT_DIR)/turnkey.linux-x86_64 env -C $(SRC_DIR) go test -v ./cmd/turnkey/... \ ') -.PHONY: version -version: - mkdir -p src/internal/version/data - git describe --tag --always --dirty --match v[0-9]\* --abbrev=8 > src/internal/version/data/version - git rev-parse HEAD > src/internal/version/data/commit - .PHONY: install install: default mkdir -p ~/.local/bin @@ -90,8 +85,10 @@ $(OUT_DIR)/turnkey.%: CGO_ENABLED=0 \ env -C $(SRC_DIR) \ go build \ + -ldflags "-X github.com/tkhq/tkcli/src/cmd/turnkey/pkg.versionString=$(VERSION)" \ -trimpath \ - -o /home/build/$@ ./cmd/turnkey/ \ + -o /home/build/$@ \ + ./cmd/turnkey/ \ ') .PHONY: build-local diff --git a/README.md b/README.md index b676fcd..c03c3d6 100644 --- a/README.md +++ b/README.md @@ -238,16 +238,34 @@ Note that you may need to do the following: To release a new version of the CLI: +Determine the next version: + +```sh +git tag | sort -n | tail -n5 +``` + +Export your new version: + +```sh +export VERSION=vX.Y.Z +``` + +Build the release artifacts: + ```sh -$ make VERSION=vX.Y.Z dist +$ make VERSION=$VERSION dist ``` -This will produce a new set of artifact in the `dist/` directory, along with a new manifest. +Cut a new release branch: + +```sh +$ git branch -b release-$VERSION +``` Open a pull request, and once you have enough approvals, tag the release: ```sh -$ git tag -sa vX.Y.Z -m "New release: X.Y.Z" +$ git tag -sa $VERSION -m "New release: $VERSION" ``` Finally, update the download table above, with links pointing to the new binaries. diff --git a/dist/Formula/turnkey.rb b/dist/Formula/turnkey.rb index 0a1a9ab..5b3f468 100644 --- a/dist/Formula/turnkey.rb +++ b/dist/Formula/turnkey.rb @@ -1,20 +1,20 @@ class Turnkey < Formula desc "Turnkey CLI" homepage "https://github.com/tkhq/tkcli" - version "v1.0.2" + version "v1.0.3" license "Apache License 2.0" if Hardware::CPU.arm? - url "https://github.com/tkhq/tkcli/raw/v1.0.2/dist/turnkey.darwin-aarch64", using: CurlDownloadStrategy - sha256 "c5cba5ecebe7ac394afaffc2e171708369e829692c3e2efaeb60ada236c8d974" + url "https://github.com/tkhq/tkcli/raw/v1.0.3/dist/turnkey.darwin-aarch64", using: CurlDownloadStrategy + sha256 "f7689f57693b524f223b34175c0278267f74b6831464386038d0ee17ee546eff" def install bin.install "turnkey.darwin-aarch64" => "turnkey" end end if Hardware::CPU.intel? - url "https://github.com/tkhq/tkcli/raw/v1.0.2/dist/turnkey.darwin-x86_64", using: CurlDownloadStrategy - sha256 "8d5f1d5315db97801f9266fa60fb45ca600b2e95b1782fdd7886c23bfb109fed" + url "https://github.com/tkhq/tkcli/raw/v1.0.3/dist/turnkey.darwin-x86_64", using: CurlDownloadStrategy + sha256 "07ffe737d5948b401e05a8d38fabedbd063f8ec69dda7d78084377ae65e5c014" def install bin.install "turnkey.darwin-x86_64" => "turnkey" diff --git a/dist/manifest.txt b/dist/manifest.txt index b084bb6..e1b51cc 100644 --- a/dist/manifest.txt +++ b/dist/manifest.txt @@ -1,6 +1,6 @@ -113819f3b86197f192c3a974df90596ed254906448c127d4a2769641842f5fa9 Formula/turnkey.rb -6b9f887e3893217bdb3e3803f81a36729c67f0aeb611074be7021d997da1a5ff release.env -c5cba5ecebe7ac394afaffc2e171708369e829692c3e2efaeb60ada236c8d974 turnkey.darwin-aarch64 -8d5f1d5315db97801f9266fa60fb45ca600b2e95b1782fdd7886c23bfb109fed turnkey.darwin-x86_64 -48cb3e3db287902112b3b001033c90426b45991e2309ee780c0c7a3dc2c6197d turnkey.linux-aarch64 -0c6036b7b2c1863aed6790338472dffc0cfbc9c51a9aa9b015402aa508afed33 turnkey.linux-x86_64 +b4fa938c49517315896f35a63ec84c66f949b7eaab579c5e86917d9fa7c685d9 Formula/turnkey.rb +058ae48aa5d85624b20cc02d15a36bb5402d867d8c4d3279f811fc813e3ba9f9 release.env +f7689f57693b524f223b34175c0278267f74b6831464386038d0ee17ee546eff turnkey.darwin-aarch64 +07ffe737d5948b401e05a8d38fabedbd063f8ec69dda7d78084377ae65e5c014 turnkey.darwin-x86_64 +f586683a4ecb6bf0f0c7f08ee64dfb41c20978f5e17c947d400973735f4e474a turnkey.linux-aarch64 +0329274a526d1d5d631a798be123097ab17c4d3205a7e71af6f8dbabd4cf4b0c turnkey.linux-x86_64 diff --git a/dist/release.env b/dist/release.env index feae9eb..1bc8633 100644 --- a/dist/release.env +++ b/dist/release.env @@ -1,5 +1,5 @@ -VERSION=v1.0.2 -GIT_REF=5e2c831e76f9166b3c402f442e6714911c4133d4 -GIT_AUTHOR=Arnaud Brousseau -GIT_KEY=68705ACF41E8ECDEE2925A424AAB800CFFA3065A -GIT_TIMESTAMP=2023-05-24 16:10:24 -0500 +VERSION=v1.0.3 +GIT_REF=cd7020e08beb88db81c11427e0e8c85779f26ee0 +GIT_AUTHOR=Seán C McCord +GIT_KEY=39B2095B61DD23EEE1BF883A8A1F048490D23AFD +GIT_TIMESTAMP=2023-10-17 12:28:02 -0400 diff --git a/dist/turnkey.darwin-aarch64 b/dist/turnkey.darwin-aarch64 index f976d01..7967b06 100755 --- a/dist/turnkey.darwin-aarch64 +++ b/dist/turnkey.darwin-aarch64 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c5cba5ecebe7ac394afaffc2e171708369e829692c3e2efaeb60ada236c8d974 -size 15442578 +oid sha256:f7689f57693b524f223b34175c0278267f74b6831464386038d0ee17ee546eff +size 16784786 diff --git a/dist/turnkey.darwin-x86_64 b/dist/turnkey.darwin-x86_64 index 7f50dbd..f012d7e 100755 --- a/dist/turnkey.darwin-x86_64 +++ b/dist/turnkey.darwin-x86_64 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8d5f1d5315db97801f9266fa60fb45ca600b2e95b1782fdd7886c23bfb109fed -size 15814304 +oid sha256:07ffe737d5948b401e05a8d38fabedbd063f8ec69dda7d78084377ae65e5c014 +size 17128448 diff --git a/dist/turnkey.linux-aarch64 b/dist/turnkey.linux-aarch64 index 1a05c63..9e2d979 100755 --- a/dist/turnkey.linux-aarch64 +++ b/dist/turnkey.linux-aarch64 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:48cb3e3db287902112b3b001033c90426b45991e2309ee780c0c7a3dc2c6197d -size 15249888 +oid sha256:f586683a4ecb6bf0f0c7f08ee64dfb41c20978f5e17c947d400973735f4e474a +size 16616537 diff --git a/dist/turnkey.linux-x86_64 b/dist/turnkey.linux-x86_64 index 202ff8d..3509e4c 100755 --- a/dist/turnkey.linux-x86_64 +++ b/dist/turnkey.linux-x86_64 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0c6036b7b2c1863aed6790338472dffc0cfbc9c51a9aa9b015402aa508afed33 -size 15893598 +oid sha256:0329274a526d1d5d631a798be123097ab17c4d3205a7e71af6f8dbabd4cf4b0c +size 17194407 diff --git a/src/cmd/turnkey/pkg/version.go b/src/cmd/turnkey/pkg/version.go index 6b8b535..7011be3 100644 --- a/src/cmd/turnkey/pkg/version.go +++ b/src/cmd/turnkey/pkg/version.go @@ -4,10 +4,10 @@ import ( "fmt" "github.com/spf13/cobra" - - "github.com/tkhq/tkcli/src/internal/version" ) +var versionString string + func init() { rootCmd.AddCommand(versionCmd) } @@ -16,7 +16,6 @@ var versionCmd = &cobra.Command{ Use: "version", Short: "display build and version information", Run: func(cmd *cobra.Command, args []string) { - fmt.Printf("Version: %s", version.Version) - fmt.Printf("Commit: %s", version.Commit) + fmt.Println(versionString) }, } diff --git a/src/internal/version/data/commit b/src/internal/version/data/commit deleted file mode 100644 index 2c1b4a2..0000000 --- a/src/internal/version/data/commit +++ /dev/null @@ -1 +0,0 @@ -0000000000000000000000000000000000000000 diff --git a/src/internal/version/data/version b/src/internal/version/data/version deleted file mode 100644 index ae39fab..0000000 --- a/src/internal/version/data/version +++ /dev/null @@ -1 +0,0 @@ -v0.0.0 diff --git a/src/internal/version/version.go b/src/internal/version/version.go deleted file mode 100644 index 8d2b1bc..0000000 --- a/src/internal/version/version.go +++ /dev/null @@ -1,15 +0,0 @@ -package version - -import ( - _ "embed" -) - -var ( - // Version is the version of the turnkey CLI. - //go:embed data/version - Version string - - // Commit is the commit SHA on which this version of the CLI tool was built. - //go:embed data/commit - Commit string -)