Add uploader downloads for Windows macOS Linux
This commit is contained in:
@@ -4,7 +4,9 @@ set -euo pipefail
|
||||
WORKDIR=${WORKDIR:-/var/www/html}
|
||||
SRC_DIR="${WORKDIR}/clients/photobooth-uploader/PhotoboothUploader"
|
||||
OUT_DIR="${WORKDIR}/public/downloads"
|
||||
OUT_FILE="${OUT_DIR}/PhotoboothUploader.exe"
|
||||
WIN_FILE="${OUT_DIR}/PhotoboothUploader-win-x64.exe"
|
||||
MAC_FILE="${OUT_DIR}/PhotoboothUploader-macos-x64"
|
||||
LINUX_FILE="${OUT_DIR}/PhotoboothUploader-linux-x64"
|
||||
STAMP_FILE="${OUT_DIR}/photobooth-uploader.hash"
|
||||
|
||||
if [[ ! -d "$SRC_DIR" ]]; then
|
||||
@@ -27,7 +29,7 @@ compute_hash() {
|
||||
|
||||
HASH=$(compute_hash)
|
||||
|
||||
if [[ -f "$OUT_FILE" && -f "$STAMP_FILE" ]]; then
|
||||
if [[ -f "$WIN_FILE" && -f "$MAC_FILE" && -f "$LINUX_FILE" && -f "$STAMP_FILE" ]]; then
|
||||
CURRENT_HASH=$(cat "$STAMP_FILE" || true)
|
||||
if [[ "$CURRENT_HASH" == "$HASH" ]]; then
|
||||
echo "[photobooth-uploader] Up to date, skipping publish."
|
||||
@@ -35,14 +37,33 @@ if [[ -f "$OUT_FILE" && -f "$STAMP_FILE" ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "[photobooth-uploader] Publishing uploader exe..."
|
||||
dotnet publish "${SRC_DIR}/PhotoboothUploader.csproj" \
|
||||
-c Release \
|
||||
-r win-x64 \
|
||||
--self-contained true \
|
||||
/p:PublishSingleFile=true \
|
||||
/p:IncludeNativeLibrariesForSelfExtract=true \
|
||||
-o "$OUT_DIR"
|
||||
publish_target() {
|
||||
local rid="$1"
|
||||
local output_file="$2"
|
||||
local temp_dir
|
||||
temp_dir=$(mktemp -d)
|
||||
|
||||
dotnet publish "${SRC_DIR}/PhotoboothUploader.csproj" \
|
||||
-c Release \
|
||||
-r "$rid" \
|
||||
--self-contained true \
|
||||
/p:PublishSingleFile=true \
|
||||
/p:IncludeNativeLibrariesForSelfExtract=true \
|
||||
-o "$temp_dir"
|
||||
|
||||
if [[ "$rid" == "win-x64" ]]; then
|
||||
mv -f "$temp_dir/PhotoboothUploader.exe" "$output_file"
|
||||
else
|
||||
mv -f "$temp_dir/PhotoboothUploader" "$output_file"
|
||||
fi
|
||||
|
||||
rm -rf "$temp_dir"
|
||||
}
|
||||
|
||||
echo "[photobooth-uploader] Publishing uploader binaries..."
|
||||
publish_target "win-x64" "$WIN_FILE"
|
||||
publish_target "osx-x64" "$MAC_FILE"
|
||||
publish_target "linux-x64" "$LINUX_FILE"
|
||||
|
||||
echo "$HASH" > "$STAMP_FILE"
|
||||
echo "[photobooth-uploader] Published to ${OUT_FILE}"
|
||||
echo "[photobooth-uploader] Published to ${OUT_DIR}"
|
||||
|
||||
Reference in New Issue
Block a user