-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add release GA workflow with goreleaser #359
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,28 @@ | ||
name: Release | ||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
goreleaser: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Go | ||
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # 5.1.0 | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@9ed2f89a662bf1735a48bc8557fd212fa902bebf # 6.1.0 | ||
with: | ||
distribution: goreleaser | ||
versions: '~> v2' | ||
args: release --clean | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,5 @@ go.work | |
.vscode | ||
|
||
cloudcost-exporter | ||
|
||
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,31 @@ | ||
# Make sure to check the documentation at https://goreleaser.com | ||
|
||
builds: | ||
- id: cloudcost-explorer | ||
binary: cloudcost-explorer | ||
main: ./cmd/exporter/exporter.go | ||
- env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
|
||
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 }}{{ .Arch }}{{ end }} | ||
{{- if .Arm }}v{{ .Arm }}{{ end }} | ||
checksum: | ||
name_template: 'checksums.txt' | ||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^docs' | ||
- '^chore(deps):' |
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,19 +1,45 @@ | ||
# Releases | ||
# Release Process | ||
|
||
There does not exist automation for releases _yet_. This is a future goal of the project. | ||
We follow [semver](https://semver.org/) and generate releases manually. See https://github.com/grafana/cloudcost-exporter/issues/18 for progress on our path to automating releases. | ||
There is a [github workflow](../../.github/workflow/docker.yml) that publishes images on changes to `main` and tags. | ||
## Building images | ||
|
||
There is a [github workflow](../../.github/workflows/docker.yml) that publishes images on changes to `main` and new tags. | ||
|
||
## Versioning | ||
|
||
We follow [semver](https://semver.org/) and generate new tags manually. | ||
|
||
To cut a release, clone `cloudcost-exporter` locally and pull latest from main. | ||
Determine if the next release is a major, minor, or hotfix. | ||
Determine if the next release is a major, minor, or hotfix. | ||
Then increment the relevant version label. | ||
|
||
For instance, let's say we're on `v0.2.2` and determined the next release is a minor change. | ||
The next version would then be `v0.3.0`. | ||
Execute the follow command and generate the tag and push it: | ||
The next version would then be `v0.3.0`. | ||
Execute the following command to generate the tag and push it: | ||
|
||
```sh | ||
git tag v0.3.0 | ||
# Optionally, add a message on why the specific version label was updated: git tag v0.3.0 -m "Adds liveness probes with backwards compatibility" | ||
git push origin tag v0.3.0 | ||
``` | ||
|
||
## Releases | ||
|
||
Creating and pushing a new tag will trigger the `goreleaser` workflow in [./.github/workflows/release.yml](https://github.com/grafana/cloudcost-exporter/tree/main/.github/workflows/release.yml). | ||
|
||
The configuration for `goreleaser` itself can be found in [./.goreleaser.yaml](https://github.com/grafana/cloudcost-exporter/blob/main/.goreleaser.yaml). | ||
|
||
See https://github.com/grafana/cloudcost-exporter/issues/18 for progress on our path to automating releases. | ||
|
||
## GitHub Actions | ||
|
||
When adding or upgrading a GitHub Actions `actions`, please set the full length commit SHA instead of the version: | ||
|
||
``` | ||
jobs: | ||
myjob: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: foo/baraction@abcdef1234567890abcdef1234567890abcdef12 # v1.2.3 | ||
``` | ||
|
||
Granular control of the version helps with security since commit SHAs are immutable. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@Pokom we can add some rules here to exclude
chore
ordocs
if you want. My thinking was that we could leave all PR titles for now and iterate later if we want to make the release notes leaner.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.
Agreed on
docs
and think that would be fine to add here, assuming it's a simple check.chore
may be related to code changes, so I would hold off on excludingchore
PR'sThere 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.
added exclusions for docs and specifically chore(deps) :)