Skip to content

Commit 7f39d4a

Browse files
committed
workflow: update to match sdhm template format
1 parent 663aa59 commit 7f39d4a

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

.github/workflows/build.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,20 @@ jobs:
5959
env:
6060
VERSION: ${{ steps.determine_version.outputs.version }}
6161
GIT_COMMIT: ${{ steps.get_git_commit.outputs.short_sha }}
62-
BUILD_TIME: ${{ github.event.repository.updated_at }}
63-
run: make build
62+
GOOS: linux
63+
GOARCH: amd64
64+
CGO_ENABLED: 0
65+
run: |
66+
ldflags="-w -s -X 'main.Version=${VERSION}' -X 'main.GitCommit=${GIT_COMMIT}' -X 'main.BuildTime=$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
67+
68+
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
69+
OUTPUT_NAME="${APP_NAME}_${GOOS}_${GOARCH}"
70+
else
71+
OUTPUT_NAME="${APP_NAME}"
72+
fi
73+
74+
mkdir -p build
75+
go build -trimpath -ldflags="${ldflags}" -o build/${OUTPUT_NAME} ./cmd/controller
6476
6577
- name: Upload Artifact
6678
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
@@ -109,4 +121,4 @@ jobs:
109121
draft: false
110122
body_path: release_notes.md
111123
prerelease: false
112-
files: build/${{ env.APP_NAME }}
124+
files: build/${{ env.APP_NAME }}_linux_amd64

0 commit comments

Comments
 (0)