Travis: Add update information for AppImage snapshots

master
Lukas Werling 2018-10-03 12:21:34 +02:00
parent 55c34ecbd7
commit 04535b5438
3 changed files with 23 additions and 8 deletions

View File

@ -80,5 +80,5 @@ after_success:
echo "Creating AppImage..." &&
tools/create_appimage.sh &&
echo "Uploading snapshot..." &&
tools/upload_snapshot.sh OpenClonk-x86_64.AppImage ||
tools/upload_snapshot.sh OpenClonk-x86_64.AppImage OpenClonk-x86_64.AppImage.zsync ||
echo "Snapshot creation has failed"

View File

@ -7,6 +7,10 @@ error() {
[[ -f CMakeCache.txt ]] || error "this does not look like a build directory"
# Read current branch from the CMake-generated C4Version.h.
branch=$(cpp -dM C4Version.h | awk '$2 == "C4REVISION_BRANCH" { print gensub("^\"|\"$", "", "g", $3) }')
[[ -n $branch ]] || error "could not get branch name"
DESTDIR=appdir cmake --build . --target install || error "install failed"
linuxdeployqt=linuxdeployqt-continuous-x86_64.AppImage
@ -18,5 +22,14 @@ fi
export ARCH=$(uname -m)
./$linuxdeployqt appdir/usr/share/applications/openclonk.desktop -appimage \
|| error "AppImage creation has failed"
# We need to run appimagetool manually to be able to specify an update URL.
coproc { exec stdbuf -oL ./$linuxdeployqt --appimage-mount; }
trap "kill -SIGINT $COPROC_PID" EXIT
read -r -u "${COPROC[0]}" mount_path
PATH="$mount_path/usr/bin:$PATH"
linuxdeployqt appdir/usr/share/applications/openclonk.desktop -bundle-non-qt-libs \
|| error "linuxdeployqt has failed"
appimagetool appdir --verbose -n -u "zsync|https://releases.openclonk.org/snapshots/latest-$branch/OpenClonk-x86_64.AppImage.zsync" \
|| error "appimagetool has failed"

View File

@ -17,11 +17,13 @@ branch=$(git symbolic-ref --short HEAD)
date=$(date --date="$(git show -s --format=%ci)" -u -Is | sed 's/+00:\?00$/Z/')
[[ -n $date ]] || error "could not get commit date"
file=${1:?no file to upload given}
: ${OC_REL_URL:?target URL not set}
(($# > 0)) || error "no files to upload given"
upload_path="/snapshots/$date-$branch-$revision/$(basename "$file")"
echo "uploading $upload_path"
for file in "$@"; do
upload_path="/snapshots/$date-$branch-$revision/$(basename "$file")"
echo "uploading $upload_path"
curl -XPOST "$OC_REL_URL$upload_path" --data-binary "@$file" \
|| error "file upload failed"
curl -XPOST "$OC_REL_URL$upload_path" --data-binary "@$file" \
|| error "file upload failed"
done