From f72ad826d89fbc221a91a26bbfba0bc64ef5b08f Mon Sep 17 00:00:00 2001 From: Ricardo Maraschini Date: Wed, 24 Jan 2024 20:13:37 +0100 Subject: [PATCH] feat: publish releases to the s3 bucket (#297) publishes the release tgz file into a s3 bucket. --- scripts/cache-files.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/cache-files.sh b/scripts/cache-files.sh index b78047974..ad22f24a0 100755 --- a/scripts/cache-files.sh +++ b/scripts/cache-files.sh @@ -80,10 +80,25 @@ function metadata() { } +function embeddedcluster() { + if [ -z "${EC_VERSION}" ]; then + echo "EC_VERSION unset, not uploading embedded cluster release" + return 0 + fi + # check if a file 'embedded-cluster-linux-amd64.tgz' exists in the directory + # if it does, upload it as releases/${ec_version}.tgz + if [ -f embedded-cluster-linux-amd64.tgz ]; then + retry 3 aws s3 cp embedded-cluster-linux-amd64.tgz "s3://${S3_BUCKET}/releases/${EC_VERSION}.tgz" + else + echo "embedded-cluster-linux-amd64.tgz not found, skipping upload" + fi +} + # there are two files to be uploaded for each release - the k0s binary and the metadata file function main() { k0sbin metadata + embeddedcluster } main "$@"