Skip to content

Commit 96fa646

Browse files
committed
Add GoReleaser config file
Signed-off-by: Marko Mudrinić <[email protected]>
1 parent d37eeae commit 96fa646

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed

.github/workflows/release.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# Copyright 2025 The KCP Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
name: goreleaser
216

317
on:
@@ -31,6 +45,9 @@ jobs:
3145

3246
- name: Delete non-semver tags
3347
run: 'git tag -d $(git tag -l | grep -v "^v")'
48+
49+
- name: Set LDFLAGS
50+
run: echo LDFLAGS="$(make ldflags)" >> $GITHUB_ENV
3451

3552
- name: Run GoReleaser on tag
3653
if: github.event_name != 'pull_request'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/_build/
2+
/dist/
23
/_tools/
34
/vendor/
45
/.kcp.e2e/

.goreleaser.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
builds:
2+
- id: "api-syncagent"
3+
main: ./cmd/api-syncagent
4+
binary: api-syncagent
5+
ldflags:
6+
- "{{ .Env.LDFLAGS }}"
7+
goos:
8+
- linux
9+
- darwin
10+
goarch:
11+
- amd64
12+
- arm64
13+
env:
14+
- CGO_ENABLED=0
15+
16+
archives:
17+
- id: api-syncagent
18+
builds:
19+
- api-syncagent
20+
21+
release:
22+
draft: true
23+
mode: keep-existing

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ GOOS ?= $(shell go env GOOS)
3030
.PHONY: all
3131
all: build test
3232

33+
ldflags:
34+
@echo $(LDFLAGS)
35+
3336
.PHONY: build
3437
build: $(CMD)
3538

0 commit comments

Comments
 (0)