5 Commits

Author SHA1 Message Date
Krzysztof
3899e761f2 fix 2025-08-03 15:03:52 +02:00
Krzysztof
34336b2de6 fix 2025-08-03 15:00:01 +02:00
Krzysztof
95f197ff60 try other options 2025-08-03 14:57:24 +02:00
Krzysztof
8ad520c1fe tweak docker fetch 2025-08-03 14:51:15 +02:00
Krzysztof
b2d535d885 build only on release 2025-08-03 14:44:39 +02:00
2 changed files with 13 additions and 2 deletions

View File

@@ -1,6 +1,8 @@
name: Docker name: Docker
on: push on:
release:
types: [published]
jobs: jobs:
push_to_registry: push_to_registry:
@@ -14,6 +16,13 @@ jobs:
steps: steps:
- name: Check out the repo - name: Check out the repo
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
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 - name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
@@ -36,6 +45,8 @@ jobs:
push: true push: true
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
build-args: |
VERSION=${{ env.VERSION }}
- name: Generate artifact attestation - name: Generate artifact attestation
uses: actions/attest-build-provenance@v2 uses: actions/attest-build-provenance@v2

View File

@@ -8,7 +8,7 @@ RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -o uptimemonitor \ 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 ./cmd/uptimemonitor
FROM alpine:latest FROM alpine:latest