chore: create packages
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>pull/840/head
parent
893d505803
commit
6abf1a05bd
@ -0,0 +1,71 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eu -o pipefail
|
||||
|
||||
: "${VERSION=}"
|
||||
: "${NFPM_CONFIG=}"
|
||||
: "${OUTPUT=.}"
|
||||
|
||||
: "${PKG_TYPES=}"
|
||||
: "${PKG_APK_RELEASES=}"
|
||||
: "${PKG_DEB_RELEASES=}"
|
||||
: "${PKG_RPM_RELEASES=}"
|
||||
: "${PKG_VENDOR=}"
|
||||
: "${PKG_PACKAGER=}"
|
||||
|
||||
if ! type nfpm > /dev/null 2>&1; then
|
||||
echo >&2 "ERROR: nfpm is required"
|
||||
exit 1
|
||||
fi
|
||||
if ! type xx-info > /dev/null 2>&1; then
|
||||
echo >&2 "ERROR: xx-info is required"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $VERSION =~ ^[a-f0-9]{7}$ ]]; then
|
||||
VERSION="v0.0.0+${VERSION}"
|
||||
fi
|
||||
|
||||
workdir=$(mktemp -d -t buildx-pkg.XXXXXXXXXX)
|
||||
trap 'rm -rf -- "$workdir"' EXIT
|
||||
mkdir -p "$workdir/docker-buildx-plugin"
|
||||
|
||||
PKG_OUTPUT="${OUTPUT}/$(xx-info os)/$(xx-info arch)/$(xx-info variant)"
|
||||
mkdir -p "${PKG_OUTPUT}"
|
||||
|
||||
for pkgtype in ${PKG_TYPES//,/ }; do
|
||||
os=$(xx-info os)
|
||||
arch=$(xx-info march)
|
||||
releases=0
|
||||
if [ $pkgtype = "static" ]; then
|
||||
cp /src/LICENSE /src/README.md "$workdir/docker-buildx-plugin/"
|
||||
if [ "$os" = "windows" ]; then
|
||||
cp /usr/bin/buildx "$workdir/docker-buildx-plugin/docker-buildx.exe"
|
||||
(set -x ; cd "$workdir" && zip -r "$PKG_OUTPUT/docker-buildx-plugin_${VERSION#v}.zip" docker-buildx-plugin)
|
||||
else
|
||||
cp /usr/bin/buildx "$workdir/docker-buildx-plugin/docker-buildx"
|
||||
(set -x ; tar -czf "$PKG_OUTPUT/docker-buildx-plugin_${VERSION#v}.tgz" -C "$workdir" docker-buildx-plugin)
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
if [ "$os" != "linux" ]; then
|
||||
continue
|
||||
fi
|
||||
case $pkgtype in
|
||||
apk)
|
||||
arch=$(xx-info alpine-arch)
|
||||
releases=$PKG_APK_RELEASES
|
||||
;;
|
||||
deb)
|
||||
arch=$(xx-info debian-arch)
|
||||
releases=$PKG_DEB_RELEASES
|
||||
;;
|
||||
rpm)
|
||||
arch=$(xx-info rhel-arch)
|
||||
releases=$PKG_RPM_RELEASES
|
||||
;;
|
||||
esac
|
||||
for release in ${releases//,/ }; do
|
||||
(set -x ; ARCH="${arch}" VERSION="${VERSION}" RELEASE="$release" VENDOR="${PKG_VENDOR}" PACKAGER="${PKG_PACKAGER}" nfpm package --config $NFPM_CONFIG --packager $pkgtype --target "$PKG_OUTPUT")
|
||||
done
|
||||
done
|
@ -0,0 +1,37 @@
|
||||
name: docker-buildx-plugin
|
||||
|
||||
# The architecture is specified using Go nomenclature (GOARCH) and translated
|
||||
# to the platform specific equivalent. In order to manually set the architecture
|
||||
# to a platform specific value, use deb_arch, rpm_arch and apk_arch.
|
||||
arch: ${ARCH}
|
||||
platform: linux
|
||||
|
||||
version: ${VERSION}
|
||||
epoch: 0
|
||||
release: ${RELEASE}
|
||||
|
||||
section: default
|
||||
|
||||
maintainer: Docker <support@docker.com>
|
||||
description: Docker Buildx plugin extends build capabilities with BuildKit.
|
||||
vendor: ${VENDOR}
|
||||
homepage: https://github.com/docker/buildx
|
||||
license: Apache-2.0
|
||||
disable_globbing: true
|
||||
|
||||
contents:
|
||||
- src: /usr/bin/buildx
|
||||
dst: /usr/libexec/docker/cli-plugins/docker-buildx
|
||||
|
||||
overrides:
|
||||
deb:
|
||||
replaces:
|
||||
- docker-ce-cli # fixes implicit conflict with docker-ce-cli package < 22.04.0. can be removed later.
|
||||
|
||||
rpm:
|
||||
group: Tools/Docker
|
||||
packager: ${PACKAGER}
|
||||
compression: xz
|
||||
|
||||
deb:
|
||||
compression: xz
|
Loading…
Reference in New Issue