diff options
| author | KunoiSayami <[email protected]> | 2021-11-07 13:48:41 +0800 |
|---|---|---|
| committer | KunoiSayami <[email protected]> | 2021-11-07 13:48:41 +0800 |
| commit | 254846d3da3f6c7fb70b316f5ebdf2ce4215309f (patch) | |
| tree | 67b310059f2825fc0555e05704706b5dc7e5d710 /utils/ci-upload.sh | |
| parent | d1e83791bd44afe1c74ba6bd0c4ede86852005bc (diff) | |
refactor(script): Move all script to utils folder
* feat(script): Build test package not request signing for now
Signed-off-by: KunoiSayami <[email protected]>
Diffstat (limited to 'utils/ci-upload.sh')
| -rwxr-xr-x | utils/ci-upload.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/utils/ci-upload.sh b/utils/ci-upload.sh new file mode 100755 index 0000000..69f19cd --- /dev/null +++ b/utils/ci-upload.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# end up when failed +set -Eeuo pipefail + +# clean up when exit +trap cleanup SIGINT SIGTERM ERR EXIT +cleanup() { + trap - SIGINT SIGTERM ERR EXIT + unset ARCH + unset PKGDEST +} + +ARCH=$(uname -m) +PKGDEST="${PWD}/packages/$ARCH" + +if [ $(find $PKGDEST -name \*.pkg\* | wc -l) -eq 0 ]; then + echo -e "\033[0;31mCould not find any packaged packages, skip upload\033[0m" + exit 0 +fi + +curl -d "token=$UPLOAD_TOKEN&action=REQUIRE_CLEAN&arch=$ARCH" -fsSL "$REMOTE_PATH" + +pushd $PKGDEST + +for file in *.pkg*; do + echo "Start upload package $file size: $(ls -lh $file | awk '{print $5}')..." + curl -F "file=@$file" -F "token=$UPLOAD_TOKEN" -F "arch=$ARCH" -fsSL "$REMOTE_PATH" + #echo "Stop upload package $file" +done + +popd + +curl -d "token=$UPLOAD_TOKEN&action=UPLOADED&arch=$ARCH" -fsSL "$REMOTE_PATH" + +if [ -r .fail ]; then + exit 2; +fi |
