Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make compression of assets optional #83

Merged
merged 1 commit into from Jun 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions action.yml
Expand Up @@ -84,6 +84,11 @@ inputs:
required: false
default: ''

compress_assets:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think provide several options for this would be better:

  • auto: current behavior
  • off: disable
  • zip: all use zip for the compression, including Linux
    Maybe other compression methods in the future.

How's your option?

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

runs:
using: 'docker'
image: 'Dockerfile'
Expand All @@ -108,6 +113,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
Expand Up @@ -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)
Expand Down