Skip to content

Commit

Permalink
Use compress_assets_format parameter to control binary packaged format
Browse files Browse the repository at this point in the history
  • Loading branch information
mjmayer committed Sep 14, 2022
1 parent 18e8043 commit bdf1d7e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -73,8 +73,8 @@ jobs:
| asset_name | **Optional** | Customize asset name if do not want to use the default format `${BINARY_NAME}-${RELEASE_TAG}-${GOOS}-${GOARCH}`. <br>Make sure set it correctly, especially for matrix usage that you have to append `-${{ matrix.goos }}-${{ matrix.goarch }}`. A valid example could be `asset_name: binary-name-${{ matrix.goos }}-${{ matrix.goarch }}`. |
| retry | **Optional** | How many times retrying if upload fails. `3` by default. |
| post_command | **Optional** | Extra command that will be executed for teardown work. e.g. you can use it to upload artifacts to AWS s3 or aliyun OSS |
| compress_assets | **Optional** | Upload execuable binaries rather than `.tar.gz` or `.zip` package. |
| zip_assets | **Optional** | Upload executable binaries published in a `.zip` package. `FALSE` by default. |
| compress_assets | **Optional** | Upload executable binaries rather than `.tar.gz` or `.zip` package. |
| compress_assets_format | **Optional** | Values of `zip` or `gz` will produce executable binaries in the specified format . `""` default. By default linux binaries will be `gz` format and windows binaries will be `zip`|

### Advanced Example

Expand Down
7 changes: 3 additions & 4 deletions action.yml
Expand Up @@ -91,10 +91,10 @@ inputs:
description: 'Compress assets before uploading'
required: false
default: 'TRUE'
zip_assets:
description: 'Produce zip file assets for all platforms'
compress_assets_format:
description: 'Defines compression method for compressed assets'
required: false
default: 'FALSE'
default: ''

runs:
using: 'docker'
Expand All @@ -121,7 +121,6 @@ runs:
- ${{ inputs.retry }}
- ${{ inputs.post_command }}
- ${{ inputs.compress_assets }}
- ${{ inputs.zip_assets }}

branding:
icon: 'package'
Expand Down
13 changes: 7 additions & 6 deletions release.sh
Expand Up @@ -106,16 +106,17 @@ ls -lha

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' || ${INPUT_ZIP_ASSETS} == 'TRUE' ]; then
if [ ${INPUT_GOOS} != 'windows' || ${INPUT_COMPRESS_ASSETS_FORMAT} == 'gz' ]; then
RELEASE_ASSET_EXT='.tar.gz'
MEDIA_TYPE='application/gzip'
RELEASE_ASSET_FILE=${RELEASE_ASSET_NAME}${RELEASE_ASSET_EXT}
( shopt -s dotglob; tar cvfz ${RELEASE_ASSET_FILE} * )
fi
if [ ${INPUT_GOOS} == 'windows' || ${INPUT_COMPRESS_ASSETS_FORMAT} == 'zip' ]; 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
RELEASE_ASSET_EXT=${EXT}
Expand Down

0 comments on commit bdf1d7e

Please sign in to comment.