-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add release GA workflow with goreleaser (#359)
Co-authored-by: Mark <[email protected]>
- Loading branch information
1 parent
4136ea7
commit 74b97eb
Showing
6 changed files
with
98 additions
and
11 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
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. |