-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
- Loading branch information
Showing
8 changed files
with
145 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env sh | ||
|
||
set -e | ||
|
||
case $1 in | ||
"version") | ||
git describe --match 'v[0-9]*' --dirty='.m' --always --tags | ||
;; | ||
"revision") | ||
echo "$(git rev-parse HEAD)$(if ! git diff --no-ext-diff --quiet --exit-code; then echo .m; fi)" | ||
;; | ||
*) | ||
echo "usage: ./hack/git-meta <version|revision>" | ||
exit 1 | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
: "${BUILDX_CMD=docker buildx}" | ||
: "${DESTDIR=./bin/release}" | ||
: "${CACHE_FROM=}" | ||
: "${CACHE_TO=}" | ||
|
||
: "${SIGN=}" | ||
: "${PFX=}" | ||
: "${PFXPASSWORD=}" | ||
|
||
if [ -n "$CACHE_FROM" ]; then | ||
for cfrom in $CACHE_FROM; do | ||
cacheFlags+=(--set "*.cache-from=$cfrom") | ||
done | ||
fi | ||
if [ -n "$CACHE_TO" ]; then | ||
for cto in $CACHE_TO; do | ||
cacheFlags+=(--set "*.cache-to=$cto") | ||
done | ||
fi | ||
|
||
dockerpfx=$(mktemp -t dockercredhelper-pfx.XXXXXXXXXX) | ||
function clean { | ||
rm -f "$dockerpfx" | ||
} | ||
trap clean EXIT | ||
|
||
# release | ||
( | ||
set -x | ||
${BUILDX_CMD} bake "${cacheFlags[@]}" --set "*.output=$DESTDIR" release | ||
) | ||
|
||
# wrap binaries | ||
mv -f ./${DESTDIR}/**/* ./${DESTDIR}/ | ||
find ./${DESTDIR} -type d -empty -delete | ||
|
||
# sign binaries | ||
if [ -n "$SIGN" ]; then | ||
for f in "${DESTDIR}"/*".darwin-"*; do | ||
SIGNINGHASH=$(security find-identity -v -p codesigning | grep "Developer ID Application: Docker Inc" | cut -d ' ' -f 4) | ||
xcrun -log codesign -s "$SIGNINGHASH" --force --verbose "$f" | ||
xcrun codesign --verify --deep --strict --verbose=2 --display "$f" | ||
done | ||
for f in "${DESTDIR}"/*".windows-"*; do | ||
echo ${PFX} | base64 -d > "$dockerpfx" | ||
signtool sign /fd SHA256 /a /f pfx /p ${PFXPASSWORD} /d Docker /du https://www.docker.com /t http://timestamp.verisign.com/scripts/timestamp.dll "$f" | ||
done | ||
fi | ||
|
||
# checksums | ||
if ! command shasum --version > /dev/null 2>&1; then | ||
echo >&2 "ERROR: shasum is required" | ||
exit 1 | ||
fi | ||
find ./${DESTDIR}/ -type f \( -iname "docker-credential-*" \) -print0 | sort -z | xargs -0 shasum -a 256 -b | sed 's# .*/# #' > ./${DESTDIR}/checksums.txt | ||
|
||
# verify | ||
( | ||
cd ./${DESTDIR} | ||
shasum -a 256 -U -c checksums.txt | ||
) |