diff --git a/.github/workflows/bundle.yml b/.github/workflows/bundle.yml index f276b180..e150309d 100644 --- a/.github/workflows/bundle.yml +++ b/.github/workflows/bundle.yml @@ -150,7 +150,7 @@ jobs: - name: Generate update manifest run: | - ./src-tauri/scripts/updater.sh --version=${{ needs.bundle.outputs.tag }} --manifest=manifest.json + ./src-tauri/scripts/updater.sh --endpoint=${{ vars.S3_ENDPOINT }} --bucket=${{ vars.S3_BUCKET }} --version=${{ needs.bundle.outputs.tag }} --manifest=manifest.json - name: Publish update manifest env: diff --git a/src-tauri/scripts/updater.sh b/src-tauri/scripts/updater.sh index 7d139b01..68018c57 100755 --- a/src-tauri/scripts/updater.sh +++ b/src-tauri/scripts/updater.sh @@ -4,14 +4,18 @@ # # Copyright 2024, Prose Foundation -CDN_BASE_URL="https://files.prose.org/apps" - # Read arguments while [ "$1" != "" ]; do argument_key=`echo $1 | awk -F= '{print $1}'` argument_value=`echo $1 | awk -F= '{print $2}'` case $argument_key in + -e | --endpoint) + ENDPOINT_URL="$argument_value" + ;; + -b | --bucket) + BUCKET="$argument_value" + ;; -v | --version) # Notice: strip any leading 'v' to the version number VERSION="${argument_value/v}" @@ -28,6 +32,20 @@ while [ "$1" != "" ]; do shift done +# Ensure endpoint URL is provided +if [ -z "$ENDPOINT_URL" ]; then + echo "No endpoint URL was provided, please provide it using '--endpoint'" + + exit 1 +fi + +# Ensure bucket is provided +if [ -z "$BUCKET" ]; then + echo "No bucket was provided, please provide it using '--bucket'" + + exit 1 +fi + # Ensure release version is provided if [ -z "$VERSION" ]; then echo "No version was provided, please provide it using '--version'" @@ -43,7 +61,7 @@ function generate_url { extension=$4 # Generate version update archive URL - url="$CDN_BASE_URL/versions/$VERSION/$platform/$architecture/update/" + url="$ENDPOINT_URL/$BUCKET/versions/$VERSION/$platform/$architecture/update/" url+="Prose$extension.tar.gz" # Ensure file exists at URL