Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Pre-release

on:
push:
tags:
- 'v*'

permissions:
contents: write
discussions: write

jobs:
build-and-create-prerelease:
runs-on: ubuntu-latest
steps:
- name: Checkout (full history)
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
id: go
- name: Extract versions from go.mod
id: versions
run: |
# Extract Go version from go.mod
GO_VERSION=$(grep '^go ' go.mod | awk '{print $2}')
echo "go-version=${GO_VERSION}" >> $GITHUB_OUTPUT

# Extract k8s.io/client-go version from go.mod
CLIENT_GO_VERSION=$(go list -m -f '{{.Version}}' k8s.io/client-go)
echo "client-go-version=${CLIENT_GO_VERSION}" >> $GITHUB_OUTPUT

echo "📦 Go version: ${GO_VERSION}"
echo "📦 k8s.io/client-go version: ${CLIENT_GO_VERSION}"
- name: Make pre-release
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO_VERSION: ${{ steps.versions.outputs.go-version }}
K8S_CLIENT_VERSION: ${{ steps.versions.outputs.client-go-version }}
73 changes: 73 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
version: 2

archives:
- formats: [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 }}

changelog:
use: github
sort: asc
groups:
- title: "Features"
regexp: "(?i)(feat|feature|\\[feature\\]|\\[feat\\]|\\bFEATURE\\b)"
order: 1
- title: "Bug Fixes"
regexp: "(?i)(fix|bugfix|\\[bugfix\\]|\\[BUGFIX\\]|\\bBUGFIX\\b)"
order: 2
- title: "Documentation"
regexp: "(?i)(docs?|documentation|\\[docs?\\])"
order: 3
- title: "Dependencies"
regexp: "(?i)(build\\(deps\\)|bump|dependencies)"
order: 4
- title: "Maintenance"
regexp: "(?i)(chore|refactor|\\[chore\\])"
order: 5
- title: "Other Changes"
regexp: ".*"
order: 99

filters:
exclude:
- '^docs:'
- '^test:'
- 'merge conflict'
- 'Merge branch'
- 'Merge pull request'

release:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussions should allow user to report concerns between the prerelease-to-release period.

  # If set, will create a release discussion in the category specified.
  #
  # Warning: do not use categories in the 'Announcement' format.
  #  Check https://github.com/goreleaser/goreleaser/issues/2304 for more info.
  #
  # Default: ''.
  discussion_category_name: Releases

github:
owner: kubernetes
name: kube-state-metrics

prerelease: "true"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First a release candidate (e.g. v1.2.0-rc.0) should be cut. If after a period of 7 days no bugs or issues were reported after publishing the release candidate, a stable release (e.g. v1.2.0) can be cut.

Do we plan on running a prerelease: false workflow after 7 days?

Copy link
Contributor Author

@Rishab87 Rishab87 Oct 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking of creating a seperate post release workflow (for merging back to main and running kpromo first) after which we can mark the release as the main release manually (we need to do mark it as main manually because it needs to be done after the merging of the kpromo PR & the 7 day wait period).


header: |
## {{ .Tag }} / {{ .Now.Format "2006-01-02" }}

{{- if index .Env "GO_VERSION" }}
## Note
- This release builds with Go `{{ index .Env "GO_VERSION" }}`
{{- end }}

{{- if index .Env "K8S_CLIENT_VERSION" }}
- This release builds with `k8s.io/client-go`: `{{ index .Env "K8S_CLIENT_VERSION" }}`
{{- end }}

footer: |
**Full Changelog**: {{ .GitURL }}/compare/{{ .PreviousTag }}...{{ .Tag }}

mode: replace
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  # You can add extra pre-existing files to the release.
  # The filename on the release will be the last part of the path (base).
  # If another file with the same name exists, the last one found will be used.
  #
  # Templates: allowed.
  extra_files:
    - glob: ./path/to/file.txt
    - glob: ./glob/**/to/**/file/**/*
    - glob: ./glob/foo/to/bar/file/foobar/override_from_previous
    - glob: ./single_file.txt
      name_template: file.txt # note that this only works if glob matches 1 file only

I believe we'll need to use this to export the openvex and SBOMs? Or is that done without this already?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they're built currently on creating a main release automatically, I don't think we should add them in pre-release here.


# If set, will create a release discussion in the category specified.
# Warning: do not use categories in the 'Announcement' format.
# Check https://github.com/goreleaser/goreleaser/issues/2304 for more info.
# Default: ''.
discussion_category_name: Releases