#27: Implement Bitbucket backup download location
This commit is contained in:
@@ -9,17 +9,27 @@ PUBLIC_KEY=./blockstorage_dev_public.pem
|
||||
APP_VER=$(grep -m1 -a version package.json|sed -e "s/\"//g" -e "s/version: //g" -e "s/,//g" -e "s/ //g")
|
||||
OUT_FILE=repertory-ui_${APP_VER}_mac.dmg
|
||||
|
||||
BITBUCKET_AUTH=$1
|
||||
|
||||
exit_script() {
|
||||
echo $1
|
||||
exit 1
|
||||
}
|
||||
|
||||
upload_to_bitbucket() {
|
||||
SOURCE_FILE=$1
|
||||
curl --fail -u "${BITBUCKET_AUTH}" -X POST https://api.bitbucket.org/2.0/repositories/blockstorage/repertory/downloads -F files=@${SOURCE_FILE} > upload_response.json || exit_script "Upload to Bitbucket failed: ${SOURCE_FILE}"
|
||||
}
|
||||
|
||||
if npm run dist; then
|
||||
cd dist
|
||||
shasum -a 256 -b ${OUT_FILE} > ${OUT_FILE}.sha256 || exit_script "Create sha256 failed"
|
||||
openssl dgst -sha256 -sign "${PRIVATE_KEY}" -out "${OUT_FILE}.sig" "${OUT_FILE}" || exit_script "Create signature failed"
|
||||
base64 "${OUT_FILE}.sig" > "${OUT_FILE}.sig.b64" || exit_script "Create base64 failed"
|
||||
|
||||
APP_SIG=$(cat ${OUT_FILE}.sig.b64)
|
||||
APP_SHA256=$(cat ${OUT_FILE}.sha256 | awk '{print $1;}')
|
||||
|
||||
rm -f upload_response.json 1>/dev/null 2>&1
|
||||
curl -F name="${OUT_FILE}" -F anonymous=true -F file="@${OUT_FILE}" https://pixeldrain.com/api/file > upload_response.json || exit_script "Upload to Pixeldrain failed"
|
||||
|
||||
@@ -31,8 +41,10 @@ if npm run dist; then
|
||||
PIXEL_ID=$(jq-osx-amd64 .id upload_response.json|sed s/\"//g)
|
||||
PIXEL_LOCATION=https://pixeldrain.com/api/file/${PIXEL_ID}
|
||||
|
||||
APP_SIG=$(cat ${OUT_FILE}.sig.b64)
|
||||
APP_SHA256=$(cat ${OUT_FILE}.sha256 | awk '{print $1;}')
|
||||
upload_to_bitbucket "${OUT_FILE}"
|
||||
upload_to_bitbucket "${OUT_FILE}.sha256"
|
||||
upload_to_bitbucket "${OUT_FILE}.sig"
|
||||
BITBUCKET_LOCATION=https://bitbucket.org/blockstorage/repertory/downloads/${OUT_FILE}
|
||||
|
||||
cp -f ../releases.json ./releases.json
|
||||
jq-osx-amd64 ".Versions[\"darwin\"]|=(.+ [\"${APP_VER}\"]|unique)" releases.json > releases_temp.json || exit_script "Update releases.json Versions failed"
|
||||
|
||||
Reference in New Issue
Block a user