Skip to content

Commit

Permalink
fix: do not hardcode s3 endpoint and bucket in updater manifest gener…
Browse files Browse the repository at this point in the history
…ator script
  • Loading branch information
valeriansaliou committed Mar 23, 2024
1 parent b9bf947 commit 7aaf2f3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
24 changes: 21 additions & 3 deletions src-tauri/scripts/updater.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -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'"
Expand All @@ -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
Expand Down

0 comments on commit 7aaf2f3

Please sign in to comment.