mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
continuous deployment (#2485)
* continuous deployment * fix * escape braces in format string * Update upload-ota.sh * curl fail on http error
This commit is contained in:
34
upload-ota.sh
Executable file
34
upload-ota.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||
|
||||
if [ -z "$TARGET" ]; then
|
||||
>&2 echo "TARGET is required"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$KEY" ]; then
|
||||
>&2 echo "KEY is required"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PLATFORM="$(cat ./PLATFORM.txt)"
|
||||
VERSION="$(cat ./VERSION.txt)"
|
||||
GIT_HASH="$(cat ./GIT_HASH.txt)"
|
||||
if [[ "$GIT_HASH" =~ ^@ ]]; then
|
||||
GIT_HASH=unknown
|
||||
else
|
||||
GIT_HASH="$(echo -n "$GIT_HASH" | head -c 7)"
|
||||
fi
|
||||
STARTOS_ENV="$(cat ./ENVIRONMENT.txt)"
|
||||
if [ -n "$STARTOS_ENV" ]; then
|
||||
GIT_HASH="$GIT_HASH~${STARTOS_ENV}"
|
||||
fi
|
||||
|
||||
BASENAME="startos-${VERSION}-${GIT_HASH}_${PLATFORM}"
|
||||
|
||||
SHASUM=$(sha256sum results/$BASENAME.squashfs | awk '{print $1}')
|
||||
|
||||
curl --fail-with-body -T results/${BASENAME}.squashfs "https://${TARGET}:8443/upload.cgi?key=${KEY}&gitHash=${GIT_HASH}&version=${VERSION}&platform=${PLATFORM}&shasum=${SHASUM}"
|
||||
Reference in New Issue
Block a user