Skip to content

Commit c4a8864

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

File tree

4 files changed

+48
-4
lines changed

4 files changed

+48
-4
lines changed

Diff for: .github/workflows/release.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ name: goreleaser
33
on:
44
pull_request:
55
paths:
6-
- .github/workflows/release.yml
7-
- .goreleaser.yaml
6+
- .github/workflows/release.yml
7+
- .goreleaser.yaml
88
push:
99
tags:
10-
- 'v*'
10+
- 'v*'
1111

1212
permissions:
1313
contents: read
@@ -31,6 +31,9 @@ jobs:
3131

3232
- name: Delete non-semver tags
3333
run: 'git tag -d $(git tag -l | grep -v "^v")'
34+
35+
- name: Set LDFLAGS
36+
run: echo LDFLAGS="$(make ldflags)" >> $GITHUB_ENV
3437

3538
- name: Run GoReleaser on tag
3639
if: github.event_name != 'pull_request'
@@ -53,7 +56,7 @@ jobs:
5356
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5457

5558
- uses: actions/upload-artifact@v4
56-
if: ${{ always() }}
59+
if: github.event_name == 'pull_request'
5760
with:
5861
name: binaries
5962
path: dist/*.tar.gz

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/_build/
2+
/dist/
23
/_tools/
34
/vendor/
45
/.kcp.e2e/

Diff for: .goreleaser.yaml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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+
15+
builds:
16+
- id: "api-syncagent"
17+
main: ./cmd/api-syncagent
18+
binary: api-syncagent
19+
ldflags:
20+
- "{{ .Env.LDFLAGS }}"
21+
goos:
22+
- linux
23+
- darwin
24+
goarch:
25+
- amd64
26+
- arm64
27+
env:
28+
- CGO_ENABLED=0
29+
30+
archives:
31+
- id: api-syncagent
32+
builds:
33+
- api-syncagent
34+
35+
release:
36+
draft: true
37+
mode: keep-existing

Diff for: Makefile

+3
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)