From e36b227643b944842299a52cb7e557ae98bf8f73 Mon Sep 17 00:00:00 2001 From: "Brad P. Crochet" Date: Fri, 22 Apr 2022 11:34:08 -0400 Subject: [PATCH] Make compression of assets optional 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 b382d58..907d9ef 100644 --- a/action.yml +++ b/action.yml @@ -84,6 +84,11 @@ inputs: required: false default: '' + compress_assets: + description: 'Compress assets before uploading' + required: false + default: 'TRUE' + runs: using: 'docker' image: 'Dockerfile' @@ -108,6 +113,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 e14ed51..0550130 100755 --- a/release.sh +++ b/release.sh @@ -85,17 +85,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)