- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2.1k
feat: Added goreleaser config for generating release notes and pre release creation #2788
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 '^ARG GOVERSION=' Dockerfile | cut -d'=' -f2) | ||
| 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 }} | 
| 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: | ||
| github: | ||
| owner: kubernetes | ||
| name: kube-state-metrics | ||
|  | ||
| prerelease: "true" | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 
 Do we plan on running a  There was a problem hiding this comment. Choose a reason for hiding this commentThe 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). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd rather see that automated after a 7-day cron, mostly because it's easy to lose track of. Also, I believe the  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cool, I'll create a seperate PR with cron to check for pre release and mark it as main There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just checked the krpomo and merging back to main does not needs to be done for pre-release, it needs to be done before marking the release as main, this is what is mentioned in  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, I guess it made sense to do a kpromo promotion for pre-release as well, so users can test out the image. But since we don't do that at the moment, and no one's asked us to do that anyway, let's keep it as you mentioned. | ||
|  | ||
| 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 | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe we'll need to use this to export the openvex and SBOMs? Or is that done without this already? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, not sure if we should skip them for pre-releases, I'd rather keep the pre-release and release workflow as coherent as possible, so the pre-release artifacts can be inspected as well. This pattern will allow us to have a nearly identical release copy to verify. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so for that I can create a seperate PR changing the existing workflow which exports openvex and sboms to run on both pre release and release? | ||
|  | ||
| # 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 | ||
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering if we can close the discussions once that period is over?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope we need to do that manually