generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 12
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 #14 from gauravkghildiyal/setup-releaser
Setup goreleaser and bump goccy/go-graphviz to newer version
- Loading branch information
Showing
6 changed files
with
148 additions
and
23 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
bin/ | ||
vendor/ | ||
.vscode/ | ||
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,50 @@ | ||
# https://goreleaser.com/ | ||
# | ||
# For local testing, use: | ||
# | ||
# goreleaser release --snapshot --clean | ||
project_name: gwctl | ||
|
||
before: | ||
hooks: | ||
# Ensure the project builds successfully before release. | ||
- make build | ||
|
||
# Refer https://goreleaser.com/customization/builds/ for all available options. | ||
builds: | ||
- id: gwctl # Build ID for reference. | ||
main: ./main.go | ||
binary: gwctl # Binary name. | ||
env: | ||
- CGO_ENABLED=0 # Disable CGO for broader compatibility. | ||
goos: | ||
- linux | ||
- darwin | ||
- windows | ||
goarch: | ||
- 386 | ||
- amd64 | ||
- arm64 | ||
ldflags: | ||
# Reduce the size of the binary. Ref: https://pkg.go.dev/cmd/link | ||
- -s -w | ||
# Embed versioning and build information in the binary. | ||
- -X sigs.k8s.io/gwctl/pkg/version.version={{.Version}} | ||
- -X sigs.k8s.io/gwctl/pkg/version.gitCommit={{.FullCommit}} | ||
- -X sigs.k8s.io/gwctl/pkg/version.buildDate={{.Date}} | ||
|
||
archives: | ||
- format: tar.gz | ||
# This name template makes the OS and Arch compatible with the results of | ||
# uname. | ||
name_template: >- | ||
{{ .ProjectName }}_ | ||
{{- title .Os }}_ | ||
{{- if eq .Arch "amd64" }}x86_64 | ||
{{- else if eq .Arch "386" }}i386 | ||
{{- else }}{{ .Arch }}{{ end }} | ||
{{- if .Arm }}v{{ .Arm }}{{ end }} | ||
# Use zip for windows archives | ||
format_overrides: | ||
- goos: windows | ||
format: zip |
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 |
---|---|---|
@@ -1,9 +1,68 @@ | ||
# Release Process | ||
|
||
The Kubernetes Template Project is released on an as-needed basis. The process is as follows: | ||
## Releasing a major or minor version | ||
|
||
1. An issue is proposing a new release with a changelog since the last release | ||
1. All [OWNERS](OWNERS) must LGTM this release | ||
1. An OWNER runs `git tag -s $VERSION` and inserts the changelog and pushes the tag with `git push $VERSION` | ||
1. The release issue is closed | ||
1. An announcement email is sent to `[email protected]` with the subject `[ANNOUNCE] kubernetes-template-project $VERSION is released` | ||
**Prerequisites:** | ||
|
||
* Install goreleaser: | ||
```bash | ||
go install github.com/goreleaser/goreleaser@latest | ||
``` | ||
**Steps:** | ||
|
||
1. Determine the release version: | ||
|
||
- Identify the `MAJOR`, `MINOR`, and `PATCH` version numbers for the release. | ||
- For example: | ||
```bash | ||
MAJOR="1" | ||
MINOR="2" | ||
PATCH="3" | ||
``` | ||
|
||
2. Create a release branch: | ||
|
||
|
||
- Create a release branch using the format `release-${MAJOR}.${MINOR}`: | ||
|
||
```bash | ||
git checkout -b release-${MAJOR}.${MINOR} | ||
``` | ||
|
||
- Push the release branch to the upstream repository: | ||
|
||
```bash | ||
git push upstream release-${MAJOR}.${MINOR} | ||
``` | ||
|
||
3. Create and push a tag: | ||
|
||
- Create a new tag using the format `v${MAJOR}.${MINOR}.${PATCH}`: | ||
|
||
```bash | ||
git tag v${MAJOR}.${MINOR}.${PATCH} | ||
``` | ||
|
||
- Push the release branch to the upstream repository: | ||
|
||
```bash | ||
git push upstream v${MAJOR}.${MINOR}.${PATCH} | ||
``` | ||
|
||
4. Build release artifacts: | ||
|
||
- Use `goreleaser` to build the release artifacts: | ||
|
||
```bash | ||
goreleaser release --clean --skip-publish | ||
``` | ||
|
||
This command generates the release artifacts in the `dist` directory. | ||
|
||
5. **Create a GitHub release:** | ||
|
||
- Go to the project's GitHub repository and navigate to the [New Releases | ||
page](https://github.com/kubernetes-sigs/gwctl/releases/new). | ||
- Select the newly created tag (`v${MAJOR}.${MINOR}.${PATCH}`) from the "Choose a tag" dropdown. | ||
- Attach the relevant release artifacts (`.tar.gz` and `.zip` files) from the `dist` directory. | ||
- Publish the release. |
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