Skip to content

Commit

Permalink
Make compression of assets optional (#83)
Browse files Browse the repository at this point in the history
Signed-off-by: Brad P. Crochet <brad@redhat.com>
  • Loading branch information
bcrochet authored Jun 13, 2022
1 parent 7833698 commit c0c0c91
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
6 changes: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ inputs:
required: false
default: ''

compress_assets:
description: 'Compress assets before uploading'
required: false
default: 'TRUE'

runs:
using: 'docker'
image: 'Dockerfile'
Expand All @@ -112,6 +117,7 @@ runs:
- ${{ inputs.asset_name }}
- ${{ inputs.retry }}
- ${{ inputs.post_command }}
- ${{ inputs.compress_assets }}

branding:
icon: 'package'
Expand Down
25 changes: 15 additions & 10 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c0c0c91

Please sign in to comment.