Skip to content

Commit c0c0c91

Browse files
authored
Make compression of assets optional (#83)
Signed-off-by: Brad P. Crochet <brad@redhat.com>
1 parent 7833698 commit c0c0c91

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

action.yml

+6
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ inputs:
8888
required: false
8989
default: ''
9090

91+
compress_assets:
92+
description: 'Compress assets before uploading'
93+
required: false
94+
default: 'TRUE'
95+
9196
runs:
9297
using: 'docker'
9398
image: 'Dockerfile'
@@ -112,6 +117,7 @@ runs:
112117
- ${{ inputs.asset_name }}
113118
- ${{ inputs.retry }}
114119
- ${{ inputs.post_command }}
120+
- ${{ inputs.compress_assets }}
115121

116122
branding:
117123
icon: 'package'

release.sh

+15-10
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,22 @@ fi
104104
cd ${BUILD_ARTIFACTS_FOLDER}
105105
ls -lha
106106

107-
# compress and package binary, then calculate checksum
108-
RELEASE_ASSET_EXT='.tar.gz'
109-
MEDIA_TYPE='application/gzip'
110-
RELEASE_ASSET_FILE=${RELEASE_ASSET_NAME}${RELEASE_ASSET_EXT}
111-
if [ ${INPUT_GOOS} == 'windows' ]; then
112-
RELEASE_ASSET_EXT='.zip'
113-
MEDIA_TYPE='application/zip'
114-
RELEASE_ASSET_FILE=${RELEASE_ASSET_NAME}${RELEASE_ASSET_EXT}
115-
( shopt -s dotglob; zip -vr ${RELEASE_ASSET_FILE} * )
107+
if [ ${INPUT_COMPRESS_ASSETS^^} == 'TRUE' ]; then
108+
# compress and package binary, then calculate checksum
109+
RELEASE_ASSET_EXT='.tar.gz'
110+
MEDIA_TYPE='application/gzip'
111+
RELEASE_ASSET_FILE=${RELEASE_ASSET_NAME}${RELEASE_ASSET_EXT}
112+
if [ ${INPUT_GOOS} == 'windows' ]; then
113+
RELEASE_ASSET_EXT='.zip'
114+
MEDIA_TYPE='application/zip'
115+
RELEASE_ASSET_FILE=${RELEASE_ASSET_NAME}${RELEASE_ASSET_EXT}
116+
( shopt -s dotglob; zip -vr ${RELEASE_ASSET_FILE} * )
117+
else
118+
( shopt -s dotglob; tar cvfz ${RELEASE_ASSET_FILE} * )
119+
fi
116120
else
117-
( shopt -s dotglob; tar cvfz ${RELEASE_ASSET_FILE} * )
121+
RELEASE_ASSET_FILE=${RELEASE_ASSET_NAME}
122+
MEDIA_TYPE="application/octet-stream"
118123
fi
119124
MD5_SUM=$(md5sum ${RELEASE_ASSET_FILE} | cut -d ' ' -f 1)
120125
SHA256_SUM=$(sha256sum ${RELEASE_ASSET_FILE} | cut -d ' ' -f 1)

0 commit comments

Comments
 (0)