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

Add support to produce zip files for all platforms #93

Merged
merged 5 commits into from Sep 24, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -73,7 +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. |
| 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`|
wangyoucao577 marked this conversation as resolved.
Show resolved Hide resolved

### Advanced Example

Expand Down
4 changes: 4 additions & 0 deletions action.yml
Expand Up @@ -91,6 +91,10 @@ inputs:
description: 'Compress assets before uploading'
required: false
default: 'TRUE'
compress_assets_format:
description: 'Defines compression method for compressed assets'
required: false
default: ''

runs:
using: 'docker'
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' ]; 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