From c0c0c91a038e4aa66fb18d6f6f263d5abf9648fc Mon Sep 17 00:00:00 2001 From: "Brad P. Crochet" Date: Mon, 13 Jun 2022 10:33:29 -0400 Subject: [PATCH] Make compression of assets optional (#83) Signed-off-by: Brad P. Crochet --- action.yml | 6 ++++++ release.sh | 25 +++++++++++++++---------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/action.yml b/action.yml index dc6a919..ad1b55d 100644 --- a/action.yml +++ b/action.yml @@ -88,6 +88,11 @@ inputs: required: false default: '' + compress_assets: + description: 'Compress assets before uploading' + required: false + default: 'TRUE' + runs: using: 'docker' image: 'Dockerfile' @@ -112,6 +117,7 @@ runs: - ${{ inputs.asset_name }} - ${{ inputs.retry }} - ${{ inputs.post_command }} + - ${{ inputs.compress_assets }} branding: icon: 'package' diff --git a/release.sh b/release.sh index 44a5229..2dbae21 100755 --- a/release.sh +++ b/release.sh @@ -104,17 +104,22 @@ fi cd ${BUILD_ARTIFACTS_FOLDER} ls -lha -# compress and package binary, then calculate checksum -RELEASE_ASSET_EXT='.tar.gz' -MEDIA_TYPE='application/gzip' -RELEASE_ASSET_FILE=${RELEASE_ASSET_NAME}${RELEASE_ASSET_EXT} -if [ ${INPUT_GOOS} == 'windows' ]; then -RELEASE_ASSET_EXT='.zip' -MEDIA_TYPE='application/zip' -RELEASE_ASSET_FILE=${RELEASE_ASSET_NAME}${RELEASE_ASSET_EXT} -( shopt -s dotglob; zip -vr ${RELEASE_ASSET_FILE} * ) +if [ ${INPUT_COMPRESS_ASSETS^^} == 'TRUE' ]; then + # compress and package binary, then calculate checksum + RELEASE_ASSET_EXT='.tar.gz' + MEDIA_TYPE='application/gzip' + RELEASE_ASSET_FILE=${RELEASE_ASSET_NAME}${RELEASE_ASSET_EXT} + if [ ${INPUT_GOOS} == 'windows' ]; then + RELEASE_ASSET_EXT='.zip' + MEDIA_TYPE='application/zip' + RELEASE_ASSET_FILE=${RELEASE_ASSET_NAME}${RELEASE_ASSET_EXT} + ( shopt -s dotglob; zip -vr ${RELEASE_ASSET_FILE} * ) + else + ( shopt -s dotglob; tar cvfz ${RELEASE_ASSET_FILE} * ) + fi else -( shopt -s dotglob; tar cvfz ${RELEASE_ASSET_FILE} * ) + RELEASE_ASSET_FILE=${RELEASE_ASSET_NAME} + MEDIA_TYPE="application/octet-stream" fi MD5_SUM=$(md5sum ${RELEASE_ASSET_FILE} | cut -d ' ' -f 1) SHA256_SUM=$(sha256sum ${RELEASE_ASSET_FILE} | cut -d ' ' -f 1)