Skip to content

Commit

Permalink
simplify release process
Browse files Browse the repository at this point in the history
Signed-off-by: Eguzki Astiz Lezaun <[email protected]>
  • Loading branch information
eguzki committed Jan 24, 2025
1 parent f79f616 commit 9c811a8
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 91 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ jobs:
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goversion: 1.21.4
ldflags: -X "github.com/kuadrant/kuadrantctl/version.GitHash=${{ github.sha }}"
ldflags: -X "github.com/kuadrant/kuadrantctl/cmd.gitSHA=${{ github.sha }}" -X "github.com/kuadrant/kuadrantctl/cmd.version=${{ github.ref_name }}"
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ test: clean-cov fmt vet $(GINKGO) ## Run unit tests


.PHONY : install
install: VERSION ?= dev
install: fmt vet ## Build and install kuadrantctl binary ($GOBIN or GOPATH/bin)
@set -e; \
GIT_SHA=$$(git rev-parse --short=7 HEAD 2>/dev/null) || { \
Expand All @@ -53,7 +54,7 @@ install: fmt vet ## Build and install kuadrantctl binary ($GOBIN or GOPATH/bin)
GIT_HASH=$${GIT_SHA}; \
fi; \
fi; \
LDFLAGS="-X 'github.com/kuadrant/kuadrantctl/version.GitHash=$$GIT_HASH'"; \
LDFLAGS="-X 'github.com/kuadrant/kuadrantctl/cmd.gitSHA=$$GIT_HASH' -X 'github.com/kuadrant/kuadrantctl/cmd.version=$(VERSION)'"; \
GOBIN=$(PROJECT_PATH)/bin $(GO) install -ldflags "$$LDFLAGS";


Expand Down
43 changes: 43 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# How to cut a new release

## Process

To release a version _“v0.W.Z”_ of the `kuadrantctl` in GitHub, follow these steps:

1. Create annotated and GPG-signed tag

```sh
git tag -s v0.W.Z -m "v0.W.Z"
git push origin v0.W.Z
```

2. In Github, [create release](https://github.com/Kuadrant/kuadrantctl/releases/new).

* Pick recently pushed git tag
* Automatically generate release notes from previous released tag
* Set as the latest release

3. Verify that the build [Release workflow](https://github.com/Kuadrant/kuadrantctl/actions/workflows/release.yaml) is triggered and completes for the new tag

### Verify new release is available

Download `kuadrantctl` binary from [releases](https://github.com/Kuadrant/kuadrantctl/releases) page.
The binary is available in multiple `OS` and `arch`. Pick your option.

```sh
wget https://github.com/Kuadrant/kuadrantctl/releases/download/v0.W.Z/kuadrantctl-v0.W.Z-{OS}-{arch}.tar.gz

tar -zxf kuadrantctl-v0.W.Z-{OS}-{arch}.tar.gz
```

2. Verify version, it should be:

```sh
./kuadrantctl version
```

The output should be the expected v0.W.Z and commitID. For example

```
kuadrantctl v0.3.0 (eec318b2e11e7ea5add5e550ff872bde64555d8f)
```
7 changes: 5 additions & 2 deletions cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ import (
"fmt"

"github.com/spf13/cobra"
)

"github.com/kuadrant/kuadrantctl/version"
var (
gitSHA string // value injected in compilation-time
version string // value injected in compilation-time
)

func versionCommand() *cobra.Command {
Expand All @@ -14,7 +17,7 @@ func versionCommand() *cobra.Command {
Short: "Print the version number of kuadrantctl",
Long: "Print the version number of kuadrantctl",
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Printf("kuadrantctl %s (%s)\n", version.Version, version.GitHash)
fmt.Printf("kuadrantctl %s (%s)\n", version, gitSHA)
return nil
},
}
Expand Down
57 changes: 0 additions & 57 deletions doc/RELEASE.md

This file was deleted.

7 changes: 0 additions & 7 deletions make/release.mk

This file was deleted.

23 changes: 0 additions & 23 deletions version/version.go

This file was deleted.

0 comments on commit 9c811a8

Please sign in to comment.