Skip to content

Commit 58e8bc1

Browse files
committed
chore: uniformize release variables in binaries
1 parent 505f40e commit 58e8bc1

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

.github/workflows/docker.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
build-args: |
5656
VERSION=${{ steps.infos.outputs.version }}
5757
COMMIT=${{ github.sha }}
58-
COMMIT_DATE=${{ steps.infos.outputs.date }}
58+
DATE=${{ steps.infos.outputs.date }}
5959
6060
# This step calls the container workflow to generate provenance and push it to
6161
# the container registry.

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ COPY . .
99
ENV CGO_ENABLED=0
1010
ARG VERSION="dev"
1111
ARG COMMIT
12-
ARG COMMIT_DATE
12+
ARG DATE
1313
RUN go build -cover \
14-
-ldflags="-s -w -X 'main.Version="$VERSION"' -X 'main.Commit="$COMMIT"' -X 'main.CommitDate="$COMMIT_DATE"'" \
14+
-ldflags="-s -w -X 'main.version="$VERSION"' -X 'main.commit="$COMMIT"' -X 'main.date="$DATE"' -X 'main.builtBy=docker'" \
1515
-o /go/bin/ctfd-setup \
1616
cmd/ctfd-setup/main.go
1717

cmd/ctfd-setup/main.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ import (
1515
)
1616

1717
var (
18-
Version = "dev"
19-
Commit = ""
20-
CommitDate = ""
18+
version = "dev"
19+
commit = ""
20+
date = ""
21+
builtBy = ""
2122
)
2223

2324
const (
@@ -434,11 +435,12 @@ func main() {
434435
435436
},
436437
},
437-
Version: Version,
438+
Version: version,
438439
Metadata: map[string]any{
439-
"version": Version,
440-
"commit": Commit,
441-
"date": CommitDate,
440+
"version": version,
441+
"commit": commit,
442+
"date": date,
443+
"builtBy": builtBy,
442444
},
443445
}
444446

0 commit comments

Comments
 (0)