Add the push functionality to upload the toolchain

This commit is contained in:
Sameer Rahmani 2023-05-09 22:00:30 +01:00
parent 12f130e415
commit 1a8122a803
Signed by: lxsameer
GPG Key ID: B0A4AF28AB9FD90B
1 changed files with 28 additions and 1 deletions

29
builder
View File

@ -47,6 +47,7 @@ KERNEL_VERSION="6.0"
MUSL_VERSION="1.2.3"
IWYU_VERSION="14e9b208914a84fcdf49bf9f5d08897a4b3dc4b8"
BOEHMGC_VERSION="8.2.2"
DEV_HEROES="https://devheroes.codes"
TARGET=x86_64-pc-linux-musl
@ -60,7 +61,8 @@ export LLVM_VERSION \
MUSL_VERSION \
TARGET \
IWYU_VERSION \
BOEHMGC_VERSION
BOEHMGC_VERSION \
DEV_HEROES
ME=$(cd "$(dirname "$0")/." >/dev/null 2>&1 ; pwd -P)
@ -221,6 +223,31 @@ function test-container() { ## Run an alpine container to test the toolchain in
alpine:latest /bin/sh
}
function http_push() {
if [[ -z "$DEV_HEROES_TOKEN" ]]; then
error "\$DEV_HEROES_TOKEN is not set."
exit 1
fi
local pkg_name
local version
pkg_name="$1"
version="$2"
echo "Uploading '$pkg_name.$version.tar.zstd' to '$DEV_HEROES/api/packages/serene/generic/$pkg_name/$version/$pkg_name.$version.tar.zstd'"
curl "$DEV_HEROES/api/packages/serene/generic/$pkg_name/$version/$pkg_name.$version.tar.zstd" \
--upload-file "$pkg_name.$version.tar.zstd" \
--progress-bar \
-H "accept: application/json" \
-H "Authorization: token $DEV_HEROES_TOKEN" \
-H "Content-Type: application/json"
}
function push() { ## Push the final tarball to the repository
# NOTE: You need to provide $DEV_HEROES_TOKEN while calling the push
# subcommand
http_push "serene_toolchain" "$LLVM_MAJOR_VERSION.$LLVM_VERSION"
}
function help() { ## Print out this help message
echo "Commands:"