Skip to content

Commit

Permalink
chore: uniformize release variables in binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
pandatix committed Oct 30, 2024
1 parent 505f40e commit 58e8bc1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
build-args: |
VERSION=${{ steps.infos.outputs.version }}
COMMIT=${{ github.sha }}
COMMIT_DATE=${{ steps.infos.outputs.date }}
DATE=${{ steps.infos.outputs.date }}
# This step calls the container workflow to generate provenance and push it to
# the container registry.
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ COPY . .
ENV CGO_ENABLED=0
ARG VERSION="dev"
ARG COMMIT
ARG COMMIT_DATE
ARG DATE
RUN go build -cover \
-ldflags="-s -w -X 'main.Version="$VERSION"' -X 'main.Commit="$COMMIT"' -X 'main.CommitDate="$COMMIT_DATE"'" \
-ldflags="-s -w -X 'main.version="$VERSION"' -X 'main.commit="$COMMIT"' -X 'main.date="$DATE"' -X 'main.builtBy=docker'" \
-o /go/bin/ctfd-setup \
cmd/ctfd-setup/main.go

Expand Down
16 changes: 9 additions & 7 deletions cmd/ctfd-setup/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ import (
)

var (
Version = "dev"
Commit = ""
CommitDate = ""
version = "dev"
commit = ""
date = ""
builtBy = ""
)

const (
Expand Down Expand Up @@ -434,11 +435,12 @@ func main() {
Email: "lucastesson@protonmail.com",
},
},
Version: Version,
Version: version,
Metadata: map[string]any{
"version": Version,
"commit": Commit,
"date": CommitDate,
"version": version,
"commit": commit,
"date": date,
"builtBy": builtBy,
},
}

Expand Down

0 comments on commit 58e8bc1

Please sign in to comment.