diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index ecb8811..75e9ed2 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -30,13 +30,13 @@ jobs: matrix: os: [ubuntu-latest, windows-latest, macOS-latest] steps: + - name: Check out code + uses: actions/checkout@v3 + - name: Set up Go uses: actions/setup-go@v4 with: - go-version: 1.24.x - - - name: Check out code - uses: actions/checkout@v3 + go-version-file: 'go.mod' - name: Build run: go build . diff --git a/.github/workflows/dockerhub-push.yml b/.github/workflows/dockerhub-push.yml index c5bf086..2068e07 100644 --- a/.github/workflows/dockerhub-push.yml +++ b/.github/workflows/dockerhub-push.yml @@ -37,4 +37,6 @@ jobs: context: . platforms: linux/amd64,linux/arm64,linux/arm push: true + build-args: | + VERSION=${{ steps.meta.outputs.TAG }} tags: projectdiscovery/pdtm:latest,projectdiscovery/pdtm:${{ steps.meta.outputs.TAG }} \ No newline at end of file diff --git a/.github/workflows/release-binary.yml b/.github/workflows/release-binary.yml index c67eeb2..a5d2f1c 100644 --- a/.github/workflows/release-binary.yml +++ b/.github/workflows/release-binary.yml @@ -18,7 +18,7 @@ jobs: - name: "Set up Go" uses: actions/setup-go@v4 with: - go-version: 1.24.x + go-version-file: 'go.mod' check-latest: true cache: true diff --git a/.github/workflows/release-test.yml b/.github/workflows/release-test.yml index 5a9c968..bd89131 100644 --- a/.github/workflows/release-test.yml +++ b/.github/workflows/release-test.yml @@ -20,7 +20,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: 1.24.x + go-version-file: 'go.mod' - name: release test uses: goreleaser/goreleaser-action@v4 diff --git a/.github/workflows/setup-test.yaml b/.github/workflows/setup-test.yaml index 6fb89a9..c27f71e 100644 --- a/.github/workflows/setup-test.yaml +++ b/.github/workflows/setup-test.yaml @@ -18,13 +18,13 @@ jobs: matrix: os: [ubuntu-latest, windows-latest, macOS-latest] steps: + - name: Check out code + uses: actions/checkout@v3 + - name: Set up Go uses: actions/setup-go@v4 with: - go-version: 1.24.x - - - name: Check out code - uses: actions/checkout@v3 + go-version-file: 'go.mod' - name: Dry Run - No Tool Installed run: go run . diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 4d07c06..29994cc 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -23,6 +23,9 @@ builds: - goos: windows goarch: 'arm64' + ldflags: + - -s -w -X github.com/projectdiscovery/pdtm/internal/runner.version={{ .Tag }} + binary: '{{ .ProjectName }}' main: cmd/{{ .ProjectName }}/{{ .ProjectName }}.go diff --git a/Dockerfile b/Dockerfile index 5fefba2..4689f4e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,10 @@ -FROM golang:1.24.3-alpine AS builder +FROM golang:1.25-alpine AS builder +ARG VERSION RUN apk add --no-cache git gcc musl-dev WORKDIR /app COPY . /app RUN go mod download -RUN go build ./cmd/pdtm +RUN go build -ldflags "-s -w ${VERSION:+-X github.com/projectdiscovery/pdtm/internal/runner.version=$VERSION}" ./cmd/pdtm FROM alpine:latest RUN apk add --no-cache bind-tools ca-certificates diff --git a/internal/runner/banner.go b/internal/runner/banner.go index f792058..e73da17 100644 --- a/internal/runner/banner.go +++ b/internal/runner/banner.go @@ -5,7 +5,10 @@ import ( updateutils "github.com/projectdiscovery/utils/update" ) -const version = "v0.1.3" +// version is the release version, injected at build time via +// -X github.com/projectdiscovery/pdtm/internal/runner.version=. +// The literal below is only a fallback for plain `go build`. +var version = "v0.1.5" var banner = ` ____