From 3899e761f2f0b54e0b171993605aebc550ebe997 Mon Sep 17 00:00:00 2001 From: Krzysztof Date: Sun, 3 Aug 2025 15:03:52 +0200 Subject: [PATCH] fix --- .github/workflows/docker.yml | 6 ++++++ Dockerfile | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index abcb843..b5be072 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -20,6 +20,10 @@ jobs: fetch-depth: 0 fetch-tags: true + - name: Get version from Git + id: version + run: echo "VERSION=$(git describe --tags)" >> $GITHUB_ENV + - name: Log in to Docker Hub uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a with: @@ -41,6 +45,8 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + build-args: | + VERSION=${{ env.VERSION }} - name: Generate artifact attestation uses: actions/attest-build-provenance@v2 diff --git a/Dockerfile b/Dockerfile index 36f965c..57ef3ba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ RUN go mod download RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \ go build -o uptimemonitor \ - -ldflags "-X uptimemonitor/pkg/version.Version=$(git describe --tags)" \ + -ldflags "-X uptimemonitor/pkg/version.Version=${VERSION:-$(git describe --tags)}" \ ./cmd/uptimemonitor FROM alpine:latest