From 744ecbe084bf32905780a7dac7fe4e29d060c149 Mon Sep 17 00:00:00 2001 From: Jay Zhang Date: Wed, 8 May 2024 11:04:19 +0000 Subject: [PATCH 1/7] feat: set baseurl --- release.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/release.sh b/release.sh index 2ceda46..8537f14 100755 --- a/release.sh +++ b/release.sh @@ -187,19 +187,19 @@ fi if [ ${INPUT_UPLOAD^^} == 'TRUE' ]; then # update binary and checksum - github-assets-uploader -logtostderr -f ${RELEASE_ASSET_PATH} -mediatype ${MEDIA_TYPE} ${GITHUB_ASSETS_UPLOADR_EXTRA_OPTIONS} -repo ${RELEASE_REPO} -token ${INPUT_GITHUB_TOKEN} -tag=${RELEASE_TAG} -releasename=${RELEASE_NAME} -retry ${INPUT_RETRY} + github-assets-uploader -logtostderr -f ${RELEASE_ASSET_PATH} -mediatype ${MEDIA_TYPE} ${GITHUB_ASSETS_UPLOADR_EXTRA_OPTIONS} -repo ${RELEASE_REPO} -token ${INPUT_GITHUB_TOKEN} -tag=${RELEASE_TAG} -releasename=${RELEASE_NAME} -retry ${INPUT_RETRY} -baseUrl ${GITHUB_SERVER_URL} if [ ${INPUT_MD5SUM^^} == 'TRUE' ]; then MD5_EXT='.md5' MD5_MEDIA_TYPE='text/plain' echo ${MD5_SUM} >${RELEASE_ASSET_PATH}${MD5_EXT} - github-assets-uploader -logtostderr -f ${RELEASE_ASSET_PATH}${MD5_EXT} -mediatype ${MD5_MEDIA_TYPE} ${GITHUB_ASSETS_UPLOADR_EXTRA_OPTIONS} -repo ${RELEASE_REPO} -token ${INPUT_GITHUB_TOKEN} -tag=${RELEASE_TAG} -releasename=${RELEASE_NAME} -retry ${INPUT_RETRY} + github-assets-uploader -logtostderr -f ${RELEASE_ASSET_PATH}${MD5_EXT} -mediatype ${MD5_MEDIA_TYPE} ${GITHUB_ASSETS_UPLOADR_EXTRA_OPTIONS} -repo ${RELEASE_REPO} -token ${INPUT_GITHUB_TOKEN} -tag=${RELEASE_TAG} -releasename=${RELEASE_NAME} -retry ${INPUT_RETRY} -baseUrl ${GITHUB_SERVER_URL} fi if [ ${INPUT_SHA256SUM^^} == 'TRUE' ]; then SHA256_EXT='.sha256' SHA256_MEDIA_TYPE='text/plain' echo ${SHA256_SUM} >${RELEASE_ASSET_PATH}${SHA256_EXT} - github-assets-uploader -logtostderr -f ${RELEASE_ASSET_PATH}${SHA256_EXT} -mediatype ${SHA256_MEDIA_TYPE} ${GITHUB_ASSETS_UPLOADR_EXTRA_OPTIONS} -repo ${RELEASE_REPO} -token ${INPUT_GITHUB_TOKEN} -tag=${RELEASE_TAG} -releasename=${RELEASE_NAME} -retry ${INPUT_RETRY} + github-assets-uploader -logtostderr -f ${RELEASE_ASSET_PATH}${SHA256_EXT} -mediatype ${SHA256_MEDIA_TYPE} ${GITHUB_ASSETS_UPLOADR_EXTRA_OPTIONS} -repo ${RELEASE_REPO} -token ${INPUT_GITHUB_TOKEN} -tag=${RELEASE_TAG} -releasename=${RELEASE_NAME} -retry ${INPUT_RETRY} -baseUrl ${GITHUB_SERVER_URL} fi fi From c758177cce6e3ff3a15ff894508a5277c21874bd Mon Sep 17 00:00:00 2001 From: Jay Zhang Date: Wed, 8 May 2024 11:08:19 +0000 Subject: [PATCH 2/7] fix: param --- release.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/release.sh b/release.sh index 8537f14..f019d91 100755 --- a/release.sh +++ b/release.sh @@ -187,19 +187,19 @@ fi if [ ${INPUT_UPLOAD^^} == 'TRUE' ]; then # update binary and checksum - github-assets-uploader -logtostderr -f ${RELEASE_ASSET_PATH} -mediatype ${MEDIA_TYPE} ${GITHUB_ASSETS_UPLOADR_EXTRA_OPTIONS} -repo ${RELEASE_REPO} -token ${INPUT_GITHUB_TOKEN} -tag=${RELEASE_TAG} -releasename=${RELEASE_NAME} -retry ${INPUT_RETRY} -baseUrl ${GITHUB_SERVER_URL} + github-assets-uploader -logtostderr -f ${RELEASE_ASSET_PATH} -mediatype ${MEDIA_TYPE} ${GITHUB_ASSETS_UPLOADR_EXTRA_OPTIONS} -repo ${RELEASE_REPO} -token ${INPUT_GITHUB_TOKEN} -tag=${RELEASE_TAG} -releasename=${RELEASE_NAME} -retry ${INPUT_RETRY} -baseurl ${GITHUB_SERVER_URL} if [ ${INPUT_MD5SUM^^} == 'TRUE' ]; then MD5_EXT='.md5' MD5_MEDIA_TYPE='text/plain' echo ${MD5_SUM} >${RELEASE_ASSET_PATH}${MD5_EXT} - github-assets-uploader -logtostderr -f ${RELEASE_ASSET_PATH}${MD5_EXT} -mediatype ${MD5_MEDIA_TYPE} ${GITHUB_ASSETS_UPLOADR_EXTRA_OPTIONS} -repo ${RELEASE_REPO} -token ${INPUT_GITHUB_TOKEN} -tag=${RELEASE_TAG} -releasename=${RELEASE_NAME} -retry ${INPUT_RETRY} -baseUrl ${GITHUB_SERVER_URL} + github-assets-uploader -logtostderr -f ${RELEASE_ASSET_PATH}${MD5_EXT} -mediatype ${MD5_MEDIA_TYPE} ${GITHUB_ASSETS_UPLOADR_EXTRA_OPTIONS} -repo ${RELEASE_REPO} -token ${INPUT_GITHUB_TOKEN} -tag=${RELEASE_TAG} -releasename=${RELEASE_NAME} -retry ${INPUT_RETRY} -baseurl ${GITHUB_SERVER_URL} fi if [ ${INPUT_SHA256SUM^^} == 'TRUE' ]; then SHA256_EXT='.sha256' SHA256_MEDIA_TYPE='text/plain' echo ${SHA256_SUM} >${RELEASE_ASSET_PATH}${SHA256_EXT} - github-assets-uploader -logtostderr -f ${RELEASE_ASSET_PATH}${SHA256_EXT} -mediatype ${SHA256_MEDIA_TYPE} ${GITHUB_ASSETS_UPLOADR_EXTRA_OPTIONS} -repo ${RELEASE_REPO} -token ${INPUT_GITHUB_TOKEN} -tag=${RELEASE_TAG} -releasename=${RELEASE_NAME} -retry ${INPUT_RETRY} -baseUrl ${GITHUB_SERVER_URL} + github-assets-uploader -logtostderr -f ${RELEASE_ASSET_PATH}${SHA256_EXT} -mediatype ${SHA256_MEDIA_TYPE} ${GITHUB_ASSETS_UPLOADR_EXTRA_OPTIONS} -repo ${RELEASE_REPO} -token ${INPUT_GITHUB_TOKEN} -tag=${RELEASE_TAG} -releasename=${RELEASE_NAME} -retry ${INPUT_RETRY} -baseurl ${GITHUB_SERVER_URL} fi fi From 6f4a0d032090f5d2b267a4ceeed0f7cb38dab487 Mon Sep 17 00:00:00 2001 From: Jay Zhang Date: Wed, 8 May 2024 11:13:28 +0000 Subject: [PATCH 3/7] feat: set baseurl only if not github public --- release.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/release.sh b/release.sh index f019d91..385b9cd 100755 --- a/release.sh +++ b/release.sh @@ -95,6 +95,10 @@ else fi fi +if [ ${GITHUB_SERVER_URL} != 'https://github.com' ]; then + BASE_SERVER_URL=${GITHUB_SERVER_URL} +fi + # build BUILD_ARTIFACTS_FOLDER=build-artifacts-$(date +%s) @@ -187,19 +191,19 @@ fi if [ ${INPUT_UPLOAD^^} == 'TRUE' ]; then # update binary and checksum - github-assets-uploader -logtostderr -f ${RELEASE_ASSET_PATH} -mediatype ${MEDIA_TYPE} ${GITHUB_ASSETS_UPLOADR_EXTRA_OPTIONS} -repo ${RELEASE_REPO} -token ${INPUT_GITHUB_TOKEN} -tag=${RELEASE_TAG} -releasename=${RELEASE_NAME} -retry ${INPUT_RETRY} -baseurl ${GITHUB_SERVER_URL} + github-assets-uploader -logtostderr -f ${RELEASE_ASSET_PATH} -mediatype ${MEDIA_TYPE} ${GITHUB_ASSETS_UPLOADR_EXTRA_OPTIONS} -repo ${RELEASE_REPO} -token ${INPUT_GITHUB_TOKEN} -tag=${RELEASE_TAG} -releasename=${RELEASE_NAME} -retry ${INPUT_RETRY} -baseurl ${BASE_SERVER_URL} if [ ${INPUT_MD5SUM^^} == 'TRUE' ]; then MD5_EXT='.md5' MD5_MEDIA_TYPE='text/plain' echo ${MD5_SUM} >${RELEASE_ASSET_PATH}${MD5_EXT} - github-assets-uploader -logtostderr -f ${RELEASE_ASSET_PATH}${MD5_EXT} -mediatype ${MD5_MEDIA_TYPE} ${GITHUB_ASSETS_UPLOADR_EXTRA_OPTIONS} -repo ${RELEASE_REPO} -token ${INPUT_GITHUB_TOKEN} -tag=${RELEASE_TAG} -releasename=${RELEASE_NAME} -retry ${INPUT_RETRY} -baseurl ${GITHUB_SERVER_URL} + github-assets-uploader -logtostderr -f ${RELEASE_ASSET_PATH}${MD5_EXT} -mediatype ${MD5_MEDIA_TYPE} ${GITHUB_ASSETS_UPLOADR_EXTRA_OPTIONS} -repo ${RELEASE_REPO} -token ${INPUT_GITHUB_TOKEN} -tag=${RELEASE_TAG} -releasename=${RELEASE_NAME} -retry ${INPUT_RETRY} -baseurl ${BASE_SERVER_URL} fi if [ ${INPUT_SHA256SUM^^} == 'TRUE' ]; then SHA256_EXT='.sha256' SHA256_MEDIA_TYPE='text/plain' echo ${SHA256_SUM} >${RELEASE_ASSET_PATH}${SHA256_EXT} - github-assets-uploader -logtostderr -f ${RELEASE_ASSET_PATH}${SHA256_EXT} -mediatype ${SHA256_MEDIA_TYPE} ${GITHUB_ASSETS_UPLOADR_EXTRA_OPTIONS} -repo ${RELEASE_REPO} -token ${INPUT_GITHUB_TOKEN} -tag=${RELEASE_TAG} -releasename=${RELEASE_NAME} -retry ${INPUT_RETRY} -baseurl ${GITHUB_SERVER_URL} + github-assets-uploader -logtostderr -f ${RELEASE_ASSET_PATH}${SHA256_EXT} -mediatype ${SHA256_MEDIA_TYPE} ${GITHUB_ASSETS_UPLOADR_EXTRA_OPTIONS} -repo ${RELEASE_REPO} -token ${INPUT_GITHUB_TOKEN} -tag=${RELEASE_TAG} -releasename=${RELEASE_NAME} -retry ${INPUT_RETRY} -baseurl ${BASE_SERVER_URL} fi fi From 5a4f7cc943fe54802ada268fca3e344dd93e020f Mon Sep 17 00:00:00 2001 From: Jay Zhang Date: Sun, 12 May 2024 02:54:46 +0000 Subject: [PATCH 4/7] fix: syntax --- release.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/release.sh b/release.sh index 385b9cd..fbaf1fa 100755 --- a/release.sh +++ b/release.sh @@ -95,6 +95,7 @@ else fi fi +BASE_SERVER_URL='' if [ ${GITHUB_SERVER_URL} != 'https://github.com' ]; then BASE_SERVER_URL=${GITHUB_SERVER_URL} fi From d75a04f81d0b7694c267fb48fae6ff114f316719 Mon Sep 17 00:00:00 2001 From: Jay Zhang Date: Sun, 12 May 2024 03:06:18 +0000 Subject: [PATCH 5/7] fix: syntax --- release.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/release.sh b/release.sh index fbaf1fa..58ec3d4 100755 --- a/release.sh +++ b/release.sh @@ -95,12 +95,12 @@ else fi fi -BASE_SERVER_URL='' +# base uploader command +BASE_UPLOADER_COMMAND="github-assets-uploader -logtostderr ${GITHUB_ASSETS_UPLOADR_EXTRA_OPTIONS} -repo ${RELEASE_REPO} -token ${INPUT_GITHUB_TOKEN} -tag=${RELEASE_TAG} -releasename=${RELEASE_NAME} -retry ${INPUT_RETRY}" if [ ${GITHUB_SERVER_URL} != 'https://github.com' ]; then - BASE_SERVER_URL=${GITHUB_SERVER_URL} + BASE_UPLOADER_COMMAND="${BASE_UPLOADER_COMMAND} -baseurl ${GITHUB_SERVER_URL}" fi - # build BUILD_ARTIFACTS_FOLDER=build-artifacts-$(date +%s) if [ ${INPUT_MULTI_BINARIES^^} == 'TRUE' ]; then @@ -192,19 +192,19 @@ fi if [ ${INPUT_UPLOAD^^} == 'TRUE' ]; then # update binary and checksum - github-assets-uploader -logtostderr -f ${RELEASE_ASSET_PATH} -mediatype ${MEDIA_TYPE} ${GITHUB_ASSETS_UPLOADR_EXTRA_OPTIONS} -repo ${RELEASE_REPO} -token ${INPUT_GITHUB_TOKEN} -tag=${RELEASE_TAG} -releasename=${RELEASE_NAME} -retry ${INPUT_RETRY} -baseurl ${BASE_SERVER_URL} + ${BASE_UPLOADER_COMMAND} -f ${RELEASE_ASSET_PATH} -mediatype ${MEDIA_TYPE} if [ ${INPUT_MD5SUM^^} == 'TRUE' ]; then MD5_EXT='.md5' MD5_MEDIA_TYPE='text/plain' echo ${MD5_SUM} >${RELEASE_ASSET_PATH}${MD5_EXT} - github-assets-uploader -logtostderr -f ${RELEASE_ASSET_PATH}${MD5_EXT} -mediatype ${MD5_MEDIA_TYPE} ${GITHUB_ASSETS_UPLOADR_EXTRA_OPTIONS} -repo ${RELEASE_REPO} -token ${INPUT_GITHUB_TOKEN} -tag=${RELEASE_TAG} -releasename=${RELEASE_NAME} -retry ${INPUT_RETRY} -baseurl ${BASE_SERVER_URL} + ${BASE_UPLOADER_COMMAND} -f ${RELEASE_ASSET_PATH}${MD5_EXT} -mediatype ${MD5_MEDIA_TYPE} fi if [ ${INPUT_SHA256SUM^^} == 'TRUE' ]; then SHA256_EXT='.sha256' SHA256_MEDIA_TYPE='text/plain' echo ${SHA256_SUM} >${RELEASE_ASSET_PATH}${SHA256_EXT} - github-assets-uploader -logtostderr -f ${RELEASE_ASSET_PATH}${SHA256_EXT} -mediatype ${SHA256_MEDIA_TYPE} ${GITHUB_ASSETS_UPLOADR_EXTRA_OPTIONS} -repo ${RELEASE_REPO} -token ${INPUT_GITHUB_TOKEN} -tag=${RELEASE_TAG} -releasename=${RELEASE_NAME} -retry ${INPUT_RETRY} -baseurl ${BASE_SERVER_URL} + ${BASE_UPLOADER_COMMAND} -f ${RELEASE_ASSET_PATH}${SHA256_EXT} -mediatype ${SHA256_MEDIA_TYPE} fi fi From 4b842719b3cb019c0634d08e0e3698e73482da9c Mon Sep 17 00:00:00 2001 From: Jay Zhang Date: Sun, 12 May 2024 03:09:37 +0000 Subject: [PATCH 6/7] fix: syntax --- release.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/release.sh b/release.sh index 58ec3d4..36275ed 100755 --- a/release.sh +++ b/release.sh @@ -95,12 +95,6 @@ else fi fi -# base uploader command -BASE_UPLOADER_COMMAND="github-assets-uploader -logtostderr ${GITHUB_ASSETS_UPLOADR_EXTRA_OPTIONS} -repo ${RELEASE_REPO} -token ${INPUT_GITHUB_TOKEN} -tag=${RELEASE_TAG} -releasename=${RELEASE_NAME} -retry ${INPUT_RETRY}" -if [ ${GITHUB_SERVER_URL} != 'https://github.com' ]; then - BASE_UPLOADER_COMMAND="${BASE_UPLOADER_COMMAND} -baseurl ${GITHUB_SERVER_URL}" -fi - # build BUILD_ARTIFACTS_FOLDER=build-artifacts-$(date +%s) if [ ${INPUT_MULTI_BINARIES^^} == 'TRUE' ]; then @@ -190,6 +184,12 @@ if [ ${INPUT_OVERWRITE^^} == 'TRUE' ]; then GITHUB_ASSETS_UPLOADR_EXTRA_OPTIONS="-overwrite" fi +# base uploader command +BASE_UPLOADER_COMMAND="github-assets-uploader -logtostderr ${GITHUB_ASSETS_UPLOADR_EXTRA_OPTIONS} -repo ${RELEASE_REPO} -token ${INPUT_GITHUB_TOKEN} -tag=${RELEASE_TAG} -releasename=${RELEASE_NAME} -retry ${INPUT_RETRY}" +if [ ${GITHUB_SERVER_URL} != 'https://github.com' ]; then + BASE_UPLOADER_COMMAND="${BASE_UPLOADER_COMMAND} -baseurl ${GITHUB_SERVER_URL}" +fi + if [ ${INPUT_UPLOAD^^} == 'TRUE' ]; then # update binary and checksum ${BASE_UPLOADER_COMMAND} -f ${RELEASE_ASSET_PATH} -mediatype ${MEDIA_TYPE} From 8c5069187280f79e809fa834875afbd6d1e7dd4a Mon Sep 17 00:00:00 2001 From: Jay Zhang Date: Sun, 12 May 2024 03:13:46 +0000 Subject: [PATCH 7/7] refactor: command prefix --- release.sh | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/release.sh b/release.sh index 36275ed..e266ced 100755 --- a/release.sh +++ b/release.sh @@ -95,6 +95,7 @@ else fi fi + # build BUILD_ARTIFACTS_FOLDER=build-artifacts-$(date +%s) if [ ${INPUT_MULTI_BINARIES^^} == 'TRUE' ]; then @@ -178,17 +179,15 @@ fi MD5_SUM=$(md5sum ${RELEASE_ASSET_PATH} | cut -d ' ' -f 1) SHA256_SUM=$(sha256sum ${RELEASE_ASSET_PATH} | cut -d ' ' -f 1) -# prefix upload extra params -GITHUB_ASSETS_UPLOADR_EXTRA_OPTIONS='' -if [ ${INPUT_OVERWRITE^^} == 'TRUE' ]; then - GITHUB_ASSETS_UPLOADR_EXTRA_OPTIONS="-overwrite" -fi - -# base uploader command -BASE_UPLOADER_COMMAND="github-assets-uploader -logtostderr ${GITHUB_ASSETS_UPLOADR_EXTRA_OPTIONS} -repo ${RELEASE_REPO} -token ${INPUT_GITHUB_TOKEN} -tag=${RELEASE_TAG} -releasename=${RELEASE_NAME} -retry ${INPUT_RETRY}" +# uploader command +BASE_UPLOADER_COMMAND="github-assets-uploader -logtostderr -repo ${RELEASE_REPO} -token ${INPUT_GITHUB_TOKEN} -tag=${RELEASE_TAG} -releasename=${RELEASE_NAME} -retry ${INPUT_RETRY}" if [ ${GITHUB_SERVER_URL} != 'https://github.com' ]; then BASE_UPLOADER_COMMAND="${BASE_UPLOADER_COMMAND} -baseurl ${GITHUB_SERVER_URL}" fi +if [ ${INPUT_OVERWRITE^^} == 'TRUE' ]; then + BASE_UPLOADER_COMMAND="${BASE_UPLOADER_COMMAND} -overwrite" +fi + if [ ${INPUT_UPLOAD^^} == 'TRUE' ]; then # update binary and checksum