#!/bin/bash -x

RELEASE_VERSION="1.1.0"

PLATFORM=$(rustc -vV | grep host | cut -d ' ' -f2)

# Set the BINARY variable based on the content of PLATFORM
if [[ "$PLATFORM" == *"windows"* ]]; then
    SRC_BINARY="pixelfed_batch_uploader.exe"
    DST_BINARY="$PLATFORM_$SRC_BINARY"
else
    SRC_BINARY="pixelfed_batch_uploader"
    DST_BINARY="$SRC_BINARY.$PLATFORM"
fi


curl --netrc \
     --upload-file target/$(rustc -vV | grep host | cut -d ' ' -f2)/release/$SRC_BINARY \
     https://repos.mxhdr.net/api/packages/maxheadroom/generic/insta-import-pixelfed/$RELEASE_VERSION/$DST_BINARY
