hack: use single output dir

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
pull/1268/head
CrazyMax 2 years ago
parent e84ed65525
commit 9c69ba6f6f
No known key found for this signature in database
GPG Key ID: 3248E46B6BB8C7F7

@ -1,3 +1 @@
bin/
cross-out/
release-out/

@ -22,7 +22,7 @@ on:
env:
REPO_SLUG: "docker/buildx-bin"
RELEASE_OUT: "./release-out"
DESTDIR: "./bin"
jobs:
test:
@ -48,7 +48,7 @@ jobs:
name: Upload coverage
uses: codecov/codecov-action@v3
with:
file: ./coverage/coverage.txt
directory: ${{ env.DESTDIR }}/coverage
prepare:
runs-on: ubuntu-latest
@ -107,7 +107,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: buildx
path: ${{ env.RELEASE_OUT }}/*
path: ${{ env.DESTDIR }}/release/*
if-no-files-found: error
bin-image:
@ -170,18 +170,18 @@ jobs:
uses: actions/download-artifact@v3
with:
name: buildx
path: ${{ env.RELEASE_OUT }}
path: ${{ env.DESTDIR }}
-
name: Create checksums
run: ./hack/hash-files
-
name: List artifacts
run: |
tree -nh ${{ env.RELEASE_OUT }}
tree -nh ${{ env.DESTDIR }}
-
name: Check artifacts
run: |
find ${{ env.RELEASE_OUT }} -type f -exec file -e ascii -- {} +
find ${{ env.DESTDIR }} -type f -exec file -e ascii -- {} +
-
name: GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
@ -190,7 +190,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: true
files: ${{ env.RELEASE_OUT }}/*
files: ${{ env.DESTDIR }}/*
buildkit-edge:
runs-on: ubuntu-latest

@ -18,11 +18,12 @@ on:
- 'README.md'
- 'docs/**'
env:
DESTDIR: "./bin"
jobs:
build:
runs-on: ubuntu-20.04
env:
BIN_OUT: ./bin
steps:
- name: Checkout
uses: actions/checkout@v3
@ -43,13 +44,13 @@ jobs:
-
name: Rename binary
run: |
mv ${{ env.BIN_OUT }}/buildx ${{ env.BIN_OUT }}/docker-buildx
mv ${{ env.DESTDIR }}/build/buildx ${{ env.DESTDIR }}/build/docker-buildx
-
name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: binary
path: ${{ env.BIN_OUT }}
path: ${{ env.DESTDIR }}/build
if-no-files-found: error
retention-days: 7

5
.gitignore vendored

@ -1,4 +1 @@
bin
coverage
cross-out
release-out
/bin

@ -8,9 +8,6 @@ else
$(error "Buildx is required: https://github.com/docker/buildx#installing")
endif
export BIN_OUT = ./bin
export RELEASE_OUT = ./release-out
shell:
./hack/shell
@ -22,7 +19,7 @@ binaries-cross:
install: binaries
mkdir -p ~/.docker/cli-plugins
install bin/buildx ~/.docker/cli-plugins/docker-buildx
install bin/build/buildx ~/.docker/cli-plugins/docker-buildx
release:
./hack/release

@ -1,17 +1,14 @@
variable "GO_VERSION" {
default = "1.19"
}
variable "BIN_OUT" {
default = "./bin"
}
variable "RELEASE_OUT" {
default = "./release-out"
}
variable "DOCS_FORMATS" {
default = "md"
}
variable "DESTDIR" {
default = "./bin"
}
// Special target: https://github.com/docker/metadata-action#bake-definition
# Special target: https://github.com/docker/metadata-action#bake-definition
target "meta-helper" {
tags = ["docker/buildx-bin:local"]
}
@ -97,13 +94,13 @@ target "mod-outdated" {
target "test" {
inherits = ["_common"]
target = "test-coverage"
output = ["./coverage"]
output = ["${DESTDIR}/coverage"]
}
target "binaries" {
inherits = ["_common"]
target = "binaries"
output = [BIN_OUT]
output = ["${DESTDIR}/build"]
platforms = ["local"]
}
@ -127,7 +124,7 @@ target "binaries-cross" {
target "release" {
inherits = ["binaries-cross"]
target = "release"
output = [RELEASE_OUT]
output = ["${DESTDIR}/release"]
}
target "image" {

@ -2,17 +2,21 @@
set -eu -o pipefail
: ${RELEASE_OUT=./release-out}
: "${DESTDIR=./bin/release}"
if [ ! -d "$DESTDIR" ]; then
exit 0
fi
# checksums
if ! type shasum > /dev/null 2>&1; then
if ! command shasum > /dev/null 2>&1; then
echo >&2 "ERROR: shasum is required"
exit 1
fi
find ./${RELEASE_OUT}/ -type f \( -iname "buildx-*" ! -iname "*darwin*" \) -print0 | sort -z | xargs -r0 shasum -a 256 -b | sed 's# .*/# #' > ./${RELEASE_OUT}/checksums.txt
find ./${DESTDIR}/ -type f \( -iname "buildx-*" ! -iname "*darwin*" \) -print0 | sort -z | xargs -r0 shasum -a 256 -b | sed 's# .*/# #' > ./${DESTDIR}/checksums.txt
# verify
(
cd ./${RELEASE_OUT}
cd ./${DESTDIR}
shasum -a 256 -U -c checksums.txt
)

@ -2,10 +2,10 @@
set -eu -o pipefail
: ${BUILDX_CMD=docker buildx}
: ${RELEASE_OUT=./release-out}
: ${CACHE_FROM=}
: ${CACHE_TO=}
: "${BUILDX_CMD=docker buildx}"
: "${DESTDIR=./bin/release}"
: "${CACHE_FROM=}"
: "${CACHE_TO=}"
if [ -n "$CACHE_FROM" ]; then
for cfrom in $CACHE_FROM; do
@ -19,10 +19,10 @@ if [ -n "$CACHE_TO" ]; then
fi
# release
(set -x ; ${BUILDX_CMD} bake "${cacheFlags[@]}" --set "*.output=$RELEASE_OUT" release)
(set -x ; ${BUILDX_CMD} bake "${cacheFlags[@]}" --set "*.output=$DESTDIR" release)
# wrap binaries
mv -f ./${RELEASE_OUT}/**/* ./${RELEASE_OUT}/
find ./${RELEASE_OUT} -type d -empty -delete
mv -f ./${DESTDIR}/**/* ./${DESTDIR}/
find ./${DESTDIR} -type d -empty -delete
source ./hack/hash-files

Loading…
Cancel
Save