Skip to content

Commit a85bd8e

Browse files
committed
Add release machinery
Add a go releaser config and a github job to automatically cut a release when we push a tag
1 parent ba8b654 commit a85bd8e

2 files changed

Lines changed: 77 additions & 0 deletions

File tree

.github/workflows/release.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v[0-9]+.[0-9]+.[0-9]+"
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: "Existing tag to release (e.g. v0.0.1)"
11+
required: true
12+
13+
permissions:
14+
contents: write
15+
16+
jobs:
17+
release:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
ref: ${{ inputs.tag || github.ref }}
25+
26+
- name: Set up Go
27+
uses: actions/setup-go@v5
28+
with:
29+
go-version-file: go.mod
30+
31+
- name: Run tests
32+
run: go test -v ./...
33+
34+
- name: Run GoReleaser
35+
uses: goreleaser/goreleaser-action@v6
36+
with:
37+
version: latest
38+
args: release --clean
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
GORELEASER_CURRENT_TAG: ${{ inputs.tag || '' }}

.goreleaser.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
version: 2
2+
3+
builds:
4+
- main: .
5+
binary: kubectl-metrics
6+
env:
7+
- CGO_ENABLED=0
8+
ldflags:
9+
- -s -w -X main.version={{.Version}}
10+
goos:
11+
- linux
12+
- darwin
13+
- windows
14+
goarch:
15+
- amd64
16+
- arm64
17+
18+
archives:
19+
- format: binary
20+
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
21+
22+
checksum:
23+
name_template: checksums.txt
24+
25+
changelog:
26+
sort: asc
27+
filters:
28+
exclude:
29+
- "^docs:"
30+
- "^test:"
31+
- "^ci:"
32+
33+
release:
34+
github:
35+
owner: Funcan
36+
name: kubectl-metrics

0 commit comments

Comments
 (0)