From 115dd077ca8d50e92f898d604e731be04ed2e1be Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Thu, 18 May 2023 11:56:10 +0200 Subject: add build scripts with alba --- .albatros | 19 ++++++++++++++ flake.lock | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++------- flake.nix | 68 ++++++++++++++++++++++++++++++++++++++---------- 3 files changed, 152 insertions(+), 22 deletions(-) diff --git a/.albatros b/.albatros index 6439de6..e190d1e 100755 --- a/.albatros +++ b/.albatros @@ -2,3 +2,22 @@ set -euxo pipefail nix build --print-build-logs .#packages.x86_64-unknown-linux-musl.debug + +if [[ ! -z $TAG && ! -z $DOCKER_AUTH ]]; then + +# Configure Docker Auth +mkdir .docker +cat > .docker/config.json <&2 + ''; + + build-container = gpkgs.writeScriptBin "aerogramme-build-container" '' + nix build --print-build-logs .#packages.x86_64-unknown-linux-musl.container -o docker/linux.amd64.tar.gz + nix build --print-build-logs .#packages.armv6l-unknown-linux-musl.container -o docker/linux.arm.tar.gz + nix build --print-build-logs .#packages.aarch64-unknown-linux-musleabihf.container -o docker/linux.arm64.tar.gz + ''; + + publish-garage = gpkgs.writeScriptBin "aerogramme-publish-garage" '' + RTAG=''${TAG:-$COMMIT} + echo "selected release tag is $RTAG" + ${alba} container push -t aerogramme:$RTAG docker/ 's3://registry.deuxfleurs.org?endpoint=garage.deuxfleurs.fr&s3ForcePathStyle=true®ion=garage' 1>&2 + ''; + + publish-docker-hub = gpkgs.writeScriptBin "aerogramme-publish-dockerhub" '' + RTAG=''${TAG:-$COMMIT} + echo "selected release tag is $RTAG" + ${alba} container push -t aerogramme:$RTAG docker/ "docker://docker.io/dxflrs/aerogramme:$RTAG" 1>&2 + ''; + + in + { + packages = { + x86_64-linux = { + inherit build-static publish-static build-container publish-garage publish-docker-hub; + }; + } // platformSpecific.packages; + }; } -- cgit v1.2.3