aboutsummaryrefslogtreecommitdiff
path: root/ci-upload.sh
diff options
context:
space:
mode:
authorCoelacanthus <[email protected]>2021-10-25 18:22:20 +0800
committerGitHub <[email protected]>2021-10-25 18:22:20 +0800
commitc7ac4208afc9f4c0c7e100d627fef7d47d0b885b (patch)
tree25b179225c1aa6eeea2a9067c20ceff392ec4867 /ci-upload.sh
parent9c42d75e17ea62786581376ff627036fd63311ef (diff)
refactor(script): add fast-fail and clean-up (#5)
Signed-off-by: Coelacanthus <[email protected]>
Diffstat (limited to 'ci-upload.sh')
-rwxr-xr-xci-upload.sh13
1 files changed, 11 insertions, 2 deletions
diff --git a/ci-upload.sh b/ci-upload.sh
index 9d2cff9..74c148a 100755
--- a/ci-upload.sh
+++ b/ci-upload.sh
@@ -1,5 +1,16 @@
#!/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"
@@ -15,5 +26,3 @@ popd
curl -d "token=$UPLOAD_TOKEN&action=UPLOADED" -fsSL "$REMOTE_PATH"
-unset ARCH
-unset PKGDEST