Skip to content

Commit

Permalink
Add app center Sparkle signing and deploy scripts (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
dexterleng authored Jun 21, 2020
1 parent 2398b92 commit d26f733
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
21 changes: 21 additions & 0 deletions scripts/create_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

set -euf -o pipefail

APP_NAME="dexterleng/Vimac"

SHOW_MASTER_BUILDS=$(appcenter build branches show -b master -a $APP_NAME)
LATEST_MASTER_BUILD_ID=$(echo "$SHOW_MASTER_BUILDS" | awk '/^Build ID:/ {print $3}')

echo "Creating release for Build ID $LATEST_MASTER_BUILD_ID."

curl -X POST \
"https://appcenter.ms/api/v0.1/apps/dexterleng/Vimac/builds/$LATEST_MASTER_BUILD_ID/distribute" \
-H "authorization: $AUTH_TOKEN" \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
-d '{
"destinations": []
}'


50 changes: 50 additions & 0 deletions scripts/deploy_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash

set -e -o pipefail

APP_NAME="dexterleng/Vimac"

# SHOW_RELEASES=$(appcenter distribute releases list -a $APP_NAME)
# LATEST_RELEASE_ID=$(echo "$SHOW_RELEASES" | awk '/^ID:/ {print $2}')

echo $LATEST_RELEASE_ID

RELEASE_API="https://appcenter.ms/api/v0.1/apps/dexterleng/Vimac/releases/${LATEST_RELEASE_ID}"

RELEASE_DOWNLOAD_URL=$(curl -X GET \
"${RELEASE_API}" \
-H "authorization: $AUTH_TOKEN" \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
| jq -r '.download_url')

echo $RELEASE_DOWNLOAD_URL

BINARY_FILE_LOCATION=$(mktemp)

curl "$RELEASE_DOWNLOAD_URL" > $BINARY_FILE_LOCATION

# Run this script from project root instead of script/
SIGN_UPDATE_OUTPUT=$(./Pods/Sparkle/bin/sign_update $BINARY_FILE_LOCATION)
SIGNATURE=$(echo $SIGN_UPDATE_OUTPUT | awk -F '"' '{print $2}')

echo $SIGN_UPDATE_OUTPUT
echo $SIGNATURE

# echo "Adding EdDSA signature and Sparkl destination for release $RELEASE_ID."

curl -X PATCH \
"${RELEASE_API}" \
-H "authorization: $AUTH_TOKEN" \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
-d "{
\"destinations\": [
{
\"name\": \"Sparkle\"
}
],
\"metadata\": {
\"ed_signature\": \"$SIGNATURE\"
}
}"

0 comments on commit d26f733

Please sign in to comment.