parent
664dc72ec5
commit
903e98ba3b
2 changed files with 48 additions and 20 deletions
34
.albatros
34
.albatros
|
@ -1,26 +1,20 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euxo pipefail
|
||||
|
||||
nix build --print-build-logs .#packages.x86_64-linux.ci -o df/linux/amd64/ci
|
||||
nix build --print-build-logs .#packages.i686-linux.ci -o df/linux/386/ci
|
||||
nix build --print-build-logs .#packages.aarch64-linux.ci -o df/linux/arm64/ci
|
||||
nix build --print-build-logs .#packages.armv6l-linux.ci -o df/linux/arm/ci
|
||||
nix run .#build-static
|
||||
nix run .#build-container
|
||||
|
||||
nix build --print-build-logs .#packages.x86_64-linux.alba -o df/linux/amd64/alba
|
||||
nix build --print-build-logs .#packages.i686-linux.alba -o df/linux/386/alba
|
||||
nix build --print-build-logs .#packages.aarch64-linux.alba -o df/linux/arm64/alba
|
||||
nix build --print-build-logs .#packages.armv6l-linux.alba -o df/linux/arm/alba
|
||||
if [[ $BRANCH == "main" && -f $SECRET_PATH ]]; then
|
||||
# Load secrets
|
||||
source $SECRET_PATH
|
||||
|
||||
nix build --print-build-logs .#packages.x86_64-linux.container -o docker/linux.amd64.tar.gz
|
||||
nix build --print-build-logs .#packages.armv6l-linux.container -o docker/linux.arm.tar.gz
|
||||
nix build --print-build-logs .#packages.aarch64-linux.container -o docker/linux.arm64.tar.gz
|
||||
nix build --print-build-logs .#packages.i686-linux.container -o docker/linux.386.tar.gz
|
||||
# Configure Docker Auth
|
||||
cat > .docker.json <<EOF
|
||||
{"auths":{"https://index.docker.io/v1/":{"auth":"${DOCKER_AUTH}"}}}
|
||||
EOF
|
||||
export DOCKER_CONFIG=`pwd`/.docker.json
|
||||
|
||||
#if [[ $BRANCH == "main" && -f $SECRET_PATH ]]; then
|
||||
# mkdir -p /kaniko/.docker
|
||||
# cp $SECRET_PATH /kaniko/.docker/config.json
|
||||
# export HOME=/kaniko
|
||||
# nix develop --command sh -c "executor --force --destination dxflrs/albatros:${COMMIT} --context dir://`pwd` --verbosity=debug" 1>&2
|
||||
#fi
|
||||
#
|
||||
# ./alba static push -t albatros:0.9 df/ 's3://download.deuxfleurs.org?endpoint=garage.deuxfleurs.fr&s3ForcePathStyle=true®ion=garage'
|
||||
nix run .#publish-static
|
||||
nix run .#publish-garage
|
||||
nix run .#publish-docker-hub
|
||||
fi
|
||||
|
|
34
flake.nix
34
flake.nix
|
@ -110,6 +110,40 @@
|
|||
packages = {
|
||||
inherit ci alba container;
|
||||
default = ci;
|
||||
|
||||
# ci/cd stuff, to be run with `nix run .#build-static` and so on
|
||||
build-static = pkgs.writeScriptBin "albatros-build-static" ''
|
||||
nix build --print-build-logs .#packages.x86_64-linux.ci -o static/linux/amd64/ci
|
||||
nix build --print-build-logs .#packages.i686-linux.ci -o static/linux/386/ci
|
||||
nix build --print-build-logs .#packages.aarch64-linux.ci -o static/linux/arm64/ci
|
||||
nix build --print-build-logs .#packages.armv6l-linux.ci -o static/linux/arm/ci
|
||||
|
||||
nix build --print-build-logs .#packages.x86_64-linux.alba -o static/linux/amd64/alba
|
||||
nix build --print-build-logs .#packages.i686-linux.alba -o static/linux/386/alba
|
||||
nix build --print-build-logs .#packages.aarch64-linux.alba -o static/linux/arm64/alba
|
||||
nix build --print-build-logs .#packages.armv6l-linux.alba -o static/linux/arm/alba
|
||||
'';
|
||||
publish-static = pkgs.writeScriptBin "albatros-push-static" ''
|
||||
RTAG=''${TAG:-$COMMIT}
|
||||
echo "selected release tag is $RTAG"
|
||||
${alba} static push -t albatros:$RTAG static/ 's3://download.deuxfleurs.org?endpoint=garage.deuxfleurs.fr&s3ForcePathStyle=true®ion=garage'
|
||||
'';
|
||||
build-container = pkgs.writeScriptBin "albatros-build-container" ''
|
||||
nix build --print-build-logs .#packages.x86_64-linux.container -o docker/linux.amd64.tar.gz
|
||||
nix build --print-build-logs .#packages.armv6l-linux.container -o docker/linux.arm.tar.gz
|
||||
nix build --print-build-logs .#packages.aarch64-linux.container -o docker/linux.arm64.tar.gz
|
||||
nix build --print-build-logs .#packages.i686-linux.container -o docker/linux.386.tar.gz
|
||||
'';
|
||||
publish-garage = pkgs.writeScriptBin "albatros-publish-garage" ''
|
||||
RTAG=''${TAG:-$COMMIT}
|
||||
echo "selected release tag is $RTAG"
|
||||
${alba} container push -t albatros:$RTAG docker/ 's3://registry.deuxfleurs.org?endpoint=garage.deuxfleurs.fr&s3ForcePathStyle=true®ion=garage'
|
||||
'';
|
||||
publish-docker-hub = pkgs.writeScriptBin "albatros-publish-dockerhub" ''
|
||||
RTAG=''${TAG:-$COMMIT}
|
||||
echo "selected release tag is $RTAG"
|
||||
${alba} container push -t albatros:$RTAG docker/ "docker://docker.io/superboum/albatros:$RTAG"
|
||||
'';
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue