Skip to content

Commit

Permalink
release: Do not create empty archives
Browse files Browse the repository at this point in the history
When there are no binary artifacts we should not be generating tarballs
since they will just be empty.

Signed-off-by: Brian Goff <[email protected]>
  • Loading branch information
cpuguy83 committed May 8, 2023
1 parent 870f720 commit b939b45
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ FROM build AS build-tar
WORKDIR /build/release
ARG CRATE
ARG TARGETOS TARGETARCH TARGETVARIANT
RUN tar -C /build/bin -czf /build/release/${CRATE}-${TARGETOS}-${TARGETARCH}${TARGETVARIANT}.tar.gz .
RUN <<EOF
if [ -n "$(find /build/bin -type f -exec echo {} \;)" ]; then
tar -C /build/bin -czf "/build/release/${CRATE}-${TARGETOS}-${TARGETARCH}${TARGETVARIANT}.tar.gz" .
fi
EOF

FROM scratch AS release-tar
COPY --link --from=build-tar /build/release/* /
Expand Down

0 comments on commit b939b45

Please sign in to comment.