diff --git a/README.md b/README.md index 4e39869..6a31c5b 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ 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. | +| compress_assets | **Optional** | `auto` default will produce a `zip` file for Windows and `tar.gz` for others. `zip` will force the use of of `zip`. `OFF` will disable packaging of assets. | ### Advanced Example diff --git a/release.sh b/release.sh index 767ac32..e5e6c1b 100755 --- a/release.sh +++ b/release.sh @@ -104,12 +104,13 @@ fi cd ${BUILD_ARTIFACTS_FOLDER} ls -lha -if [ ${INPUT_COMPRESS_ASSETS^^} == 'TRUE' ]; then +# INPUT_COMPRESS_ASSETS=='TRUE' is used for backwards compatability. `AUTO`, `ZIP`, `OFF` are the recommended values +if [ ${INPUT_COMPRESS_ASSETS^^} == "TRUE" ] || [ ${INPUT_COMPRESS_ASSETS^^} == "AUTO" ] || [ ${INPUT_COMPRESS_ASSETS^^} == "ZIP" ]; 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 + if [ ${INPUT_GOOS} == 'windows' ] || [ ${INPUT_COMPRESS_ASSETS^^} == "ZIP" ]; then RELEASE_ASSET_EXT='.zip' MEDIA_TYPE='application/zip' RELEASE_ASSET_FILE=${RELEASE_ASSET_NAME}${RELEASE_ASSET_EXT} @@ -117,11 +118,14 @@ if [ ${INPUT_COMPRESS_ASSETS^^} == 'TRUE' ]; then else ( shopt -s dotglob; tar cvfz ${RELEASE_ASSET_FILE} * ) fi -else +elif [ ${INPUT_COMPRESS_ASSETS^^} == "OFF" ]; then RELEASE_ASSET_EXT=${EXT} MEDIA_TYPE="application/octet-stream" RELEASE_ASSET_FILE=${RELEASE_ASSET_NAME}${RELEASE_ASSET_EXT} cp ${BINARY_NAME}${EXT} ${RELEASE_ASSET_FILE} +else + echo "Invalid value for INPUT_COMPRESS_ASSETS: ${INPUT_COMPRESS_ASSETS} . Acceptable values are AUTO,ZIP, or OFF." + exit 1 fi MD5_SUM=$(md5sum ${RELEASE_ASSET_FILE} | cut -d ' ' -f 1) SHA256_SUM=$(sha256sum ${RELEASE_ASSET_FILE} | cut -d ' ' -f 1)