#27: Implement Bitbucket backup download location

This commit is contained in:
Scott E. Graves
2019-07-05 13:44:39 -05:00
parent a2c66f1047
commit 82af8e9319
3 changed files with 43 additions and 6 deletions

View File

@@ -37,12 +37,17 @@ pushd "%ROOT%"
call :PIXEL_RESPONSE 1
set PIXEL_LOCATION=https://pixeldrain.com/api/file/!PIXEL_ID!
call :UPLOAD_TO_BITBUCKET "%OUT_FILE%"
call :UPLOAD_TO_BITBUCKET "%OUT_FILE%.sha256"
call :UPLOAD_TO_BITBUCKET "%OUT_FILE%.sig"
set BITBUCKET_LOCATION=https://bitbucket.org/blockstorage/repertory/downloads/%OUT_FILE%
del /q releases.json 1>NUL 2>&1
("%JQ_BIN%" ".Versions.win32|=(.+ ["""%APP_VER%"""]|unique)" ..\releases.json>releases_temp.json && move /Y releases_temp.json releases.json 1>NUL 2>&1) || (call :ERROR "Update releases.json Versions failed")
("%JQ_BIN%" ".Locations.win32."""%APP_VER%""".sig="""!APP_SIG!"""" releases.json>releases_temp.json && move /Y releases_temp.json releases.json 1>NUL 2>&1) || (call :ERROR "Update releases.json sig failed")
("%JQ_BIN%" ".Locations.win32."""%APP_VER%""".sha256="""!APP_SHA256!"""" releases.json>releases_temp.json && move /Y releases_temp.json releases.json 1>NUL 2>&1) || (call :ERROR "Update releases.json sha256 failed")
("%JQ_BIN%" ".Locations.win32."""%APP_VER%""".urls=["""!PIXEL_LOCATION!"""]" releases.json>releases_temp.json && move /Y releases_temp.json releases.json 1>NUL 2>&1) || (call :ERROR "Update releases.json URL failed")
("%JQ_BIN%" ".Locations.win32."""%APP_VER%""".urls=["""!PIXEL_LOCATION!""","""%BITBUCKET_LOCATION%"""]" releases.json>releases_temp.json && move /Y releases_temp.json releases.json 1>NUL 2>&1) || (call :ERROR "Update releases.json URL failed")
popd
) || (
call :ERROR "Create dist failed"
@@ -78,6 +83,14 @@ goto :EOF
)
goto :EOF
:UPLOAD_TO_BITBUCKET
set SOURCE_FILE=%1
call :NO_QUOTES SOURCE_FILE
call :NO_QUOTES BITBUCKET_AUTH
echo "Uploading !SOURCE_FILE! to Bitbucket"
(curl --fail -u "!BITBUCKET_AUTH!" -X POST https://api.bitbucket.org/2.0/repositories/blockstorage/repertory/downloads -F files="@!SOURCE_FILE!" > upload_response.json) || (call :ERROR "Upload to Bitbucket failed: %SOURCE_FILE%")
goto :EOF
:ERROR
echo %1
set ERROR_EXIT=1