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:
Aiden McClelland
2023-11-01 13:22:34 -06:00
committed by GitHub
parent e5b137b331
commit 547747ff74
9 changed files with 241 additions and 4 deletions

34
upload-ota.sh Executable file
View 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}"