diff --git a/.dockerignore b/.dockerignore index 038672e0..5e56e040 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1 @@ /bin -/release diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b8d7dbdf..67a34510 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -128,6 +128,8 @@ jobs: - name: Checkout uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Set up QEMU uses: docker/setup-qemu-action@v2 @@ -153,3 +155,16 @@ jobs: name: docker-credential-helpers path: ${{ env.DESTDIR }}/* if-no-files-found: error + + build-deb: + runs-on: ubuntu-20.04 + steps: + - + name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - + name: Build + run: | + make deb diff --git a/.gitignore b/.gitignore index 038672e0..5e56e040 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ /bin -/release diff --git a/Dockerfile b/Dockerfile index 78bd902b..8137f385 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ ARG XX_VERSION=1.1.2 ARG OSXCROSS_VERSION=11.3-r7-alpine ARG GOLANGCI_LINT_VERSION=v1.47.3 -ARG PKG=github.com/docker/docker-credential-helpers +ARG PACKAGE=github.com/docker/docker-credential-helpers # xx is a helper for cross-compilation FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx @@ -15,7 +15,7 @@ FROM crazymax/osxcross:${OSXCROSS_VERSION} AS osxcross FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine AS gobase COPY --from=xx / / -RUN apk add --no-cache clang file git lld llvm pkgconf rsync +RUN apk add --no-cache clang file git lld llvm make pkgconf rsync ENV GOFLAGS="-mod=vendor" ENV CGO_ENABLED="1" WORKDIR /src @@ -57,13 +57,6 @@ RUN --mount=type=bind,target=. \ --mount=from=golangci-lint,source=/usr/bin/golangci-lint,target=/usr/bin/golangci-lint \ golangci-lint run ./... -FROM gobase AS version -ARG PKG -RUN --mount=target=. \ - VERSION=$(git describe --match 'v[0-9]*' --dirty='.m' --always --tags); \ - echo "-s -w -X ${PKG}/credentials.Version=${VERSION}" | tee /tmp/.ldflags; \ - echo -n "${VERSION}" | tee /tmp/.version; - FROM gobase AS base ARG TARGETPLATFORM RUN xx-apk add musl-dev gcc libsecret-dev pass @@ -93,50 +86,49 @@ FROM scratch AS test-coverage COPY --from=test /out / FROM base AS build-linux +ARG PACKAGE ARG TARGETOS ARG TARGETARCH ARG TARGETVARIANT RUN --mount=type=bind,target=. \ --mount=type=cache,target=/root/.cache \ - --mount=type=cache,target=/go/pkg/mod \ - --mount=type=bind,from=version,source=/tmp/.ldflags,target=/tmp/.ldflags < "debian/changelog" <<-EOF -docker-credential-helpers ($version) $DISTRO; urgency=low +docker-credential-helpers ($VERSION) $DISTRO-$SUITE; urgency=low * New upstream version diff --git a/deb/debian/rules b/deb/debian/rules index e3421e97..4750af38 100755 --- a/deb/debian/rules +++ b/deb/debian/rules @@ -3,7 +3,8 @@ DESTDIR := $(CURDIR)/debian/tmp override_dh_auto_build: - make secretservice pass + make build-secretservice DESTDIR=bin + make build-pass DESTDIR=bin override_dh_auto_install: install -D bin/docker-credential-secretservice $(DESTDIR)/usr/bin/docker-credential-secretservice