Skip to content

Commit 1305260

Browse files
authored
Merge pull request #71 from Abirdcfly/main
Add Goreleaser configuration and GitHub action for releases
2 parents f2948e6 + 43cfe63 commit 1305260

File tree

3 files changed

+143
-0
lines changed

3 files changed

+143
-0
lines changed

.github/workflows/release.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: goreleaser
2+
3+
on:
4+
push:
5+
# run only against tags.
6+
tags:
7+
- 'v*'
8+
env:
9+
GO_VER: 1.20
10+
GO_TAGS: ""
11+
permissions:
12+
contents: write
13+
# packages: write
14+
# issues: write
15+
16+
jobs:
17+
goreleaser:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v3
21+
with:
22+
fetch-depth: 0
23+
- run: git fetch --force --tags
24+
- uses: actions/setup-go@v4
25+
with:
26+
go-version-file: "go.mod"
27+
# More assembly might be required: Docker logins, GPG, etc. It all depends
28+
# on your needs.
29+
- name: Login to the dockerhub Registry
30+
uses: docker/login-action@v2
31+
with:
32+
username: kubebb
33+
password: ${{ secrets.DOCKER_TOKEN }}
34+
- uses: goreleaser/goreleaser-action@v4
35+
with:
36+
# either 'goreleaser' (default) or 'goreleaser-pro':
37+
distribution: goreleaser
38+
version: latest
39+
args: release --clean
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro'
43+
# distribution:
44+
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
45+

.goreleaser.yaml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Make sure to check the documentation at https://goreleaser.com
2+
builds:
3+
- env:
4+
- CGO_ENABLED=0
5+
binary: manager
6+
id: manager
7+
goos:
8+
- linux
9+
goarch:
10+
- amd64
11+
- arm64
12+
dockers:
13+
- use: buildx
14+
image_templates:
15+
- "kubebb/core:v{{ .Version }}-amd64"
16+
build_flag_templates:
17+
- "--pull"
18+
- "--label=org.opencontainers.image.created={{.Date}}"
19+
- "--label=org.opencontainers.image.title={{.ProjectName}}"
20+
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
21+
- "--label=org.opencontainers.image.version=v{{.Version}}"
22+
- "--build-arg=GO_VER={{.Env.GO_VER}}"
23+
- "--build-arg=GO_TAGS={{.Env.GO_TAGS}}"
24+
# - "--build-arg=BUILD_ID={{.Env.SEMREV_LABEL}}" #todo
25+
# - "--build-arg=BUILD_DATE={{.Env.BUILD_DATE}}" #todo
26+
- "--platform=linux/amd64"
27+
dockerfile: goreleaser.dockefile
28+
- use: buildx
29+
image_templates:
30+
- "kubebb/core:v{{ .Version }}-arm64v8"
31+
build_flag_templates:
32+
- "--pull"
33+
- "--label=org.opencontainers.image.created={{.Date}}"
34+
- "--label=org.opencontainers.image.title={{.ProjectName}}"
35+
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
36+
- "--label=org.opencontainers.image.version=v{{.Version}}"
37+
- "--build-arg=GO_VER={{.Env.GO_VER}}"
38+
- "--build-arg=GO_TAGS={{.Env.GO_TAGS}}"
39+
# - "--build-arg=BUILD_ID={{.Env.SEMREV_LABEL}}" #todo
40+
# - "--build-arg=BUILD_DATE={{.Env.BUILD_DATE}}" #todo
41+
- "--platform=linux/arm64"
42+
dockerfile: goreleaser.dockefile
43+
snapshot:
44+
name_template: "{{ incpatch .Version }}-next"
45+
changelog:
46+
sort: asc
47+
use: github
48+
groups:
49+
- title: New Features
50+
regexp: "^.*feat[(\\w)]*:+.*$"
51+
order: 0
52+
- title: 'Bug Fixes'
53+
regexp: "^.*fix[(\\w)]*:+.*$"
54+
order: 1
55+
- title: Others
56+
order: 999
57+
filters:
58+
exclude:
59+
- '^Merge pull request'
60+
release:
61+
draft: true
62+
replace_existing_draft: false
63+
mode: append
64+
header: |
65+
## {{.ProjectName}}-v{{.Version}}
66+
67+
Welcome to this new release!
68+
69+
### Images built for this release:
70+
core: `kubebb/core:v{{ .Version }}`
71+
72+
### Breaking Changes:
73+
None
74+
75+
### Feature summary 🚀 🚀 🚀
76+
TODO
77+
footer: |
78+
## Thanks to our Contributors!
79+
80+
Thank you to everyone who contributed to {{.Tag}}! ❤️
81+
82+
And thank you very much to everyone else not listed here who contributed in other ways like filing issues, giving feedback, testing fixes, helping users in slack, etc. 🙏
83+
name_template: "v{{.Version}}"
84+
docker_manifests:
85+
- name_template: "kubebb/core:v{{ .Version }}"
86+
image_templates:
87+
- "kubebb/core:v{{ .Version }}-amd64"
88+
- "kubebb/core:v{{ .Version }}-arm64v8"
89+
skip_push: false
90+
use: docker

goreleaser.dockefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM alpine/helm:latest as helm
2+
FROM gcr.io/distroless/static:nonroot
3+
WORKDIR /
4+
COPY --from=helm /usr/bin/helm /usr/bin/helm
5+
COPY manager .
6+
USER 65532:65532
7+
8+
ENTRYPOINT ["/manager"]

0 commit comments

Comments
 (0)