From bdf1d7ed4209c6023c643c1d4937b278f0686f11 Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Wed, 14 Sep 2022 16:19:04 -0700 Subject: [PATCH] Use compress_assets_format parameter to control binary packaged format --- README.md | 4 ++-- action.yml | 7 +++---- release.sh | 13 +++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index b47f686..4751d91 100644 --- a/README.md +++ b/README.md @@ -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}`.
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 diff --git a/action.yml b/action.yml index 3c23c90..a0d2aa1 100644 --- a/action.yml +++ b/action.yml @@ -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' @@ -121,7 +121,6 @@ runs: - ${{ inputs.retry }} - ${{ inputs.post_command }} - ${{ inputs.compress_assets }} - - ${{ inputs.zip_assets }} branding: icon: 'package' diff --git a/release.sh b/release.sh index 7110e2d..6218d48 100755 --- a/release.sh +++ b/release.sh @@ -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}