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

Fix: compress asserts off not work #89

Merged
merged 4 commits into from Jul 15, 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
32 changes: 28 additions & 4 deletions .github/workflows/autotest.yml
Expand Up @@ -42,7 +42,7 @@ jobs:
# with:
# time: '300s'
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set BUILD_TIME env
run: echo BUILD_TIME=$(date) >> ${GITHUB_ENV}
- name: Run go-release-action on test code
Expand Down Expand Up @@ -75,15 +75,15 @@ jobs:
goos: [linux]
goarch: [amd64]
# "" means default
goversion: ["", "1.13", "1.14", "1.15", "1.16", "1.17", "https://golang.org/dl/go1.16.1.linux-amd64.tar.gz"]
goversion: ["", "1.13", "1.14", "1.15", "1.16", "1.17", "1.18", "https://golang.org/dl/go1.16.1.linux-amd64.tar.gz"]
steps:
# - name: Wait release docker build for release branches
# if: contains(github.ref, 'release')
# uses: jakejarvis/wait-action@master
# with:
# time: '300s'
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set GO_VERSION_TAG env
run: echo GO_VERSION_TAG=$(basename ${{ matrix.goversion }}) >> ${GITHUB_ENV}
- name: Run go-release-action on test code
Expand Down Expand Up @@ -112,7 +112,7 @@ jobs:
goarch: [amd64, arm64]
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Run go-release-action on test code
uses: ./
with:
Expand All @@ -129,3 +129,27 @@ jobs:
overwrite: true
release_tag: v0.1-test-assets
asset_name: testmain-via-makefile-${{ matrix.goos }}-${{ matrix.goarch }}

compress-assets-off-test:
name: Compress assets off Test
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, windows, darwin]
goarch: [amd64]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Run go-release-action on test code
uses: ./
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
project_path: ./test/
binary_name: testmain
pre_command: go mod init localtest
build_flags: -v
overwrite: true
release_tag: v0.1-test-assets
compress_assets: false
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -73,6 +73,7 @@ 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. |

### Advanced Example

Expand Down
1 change: 0 additions & 1 deletion action.yml
Expand Up @@ -87,7 +87,6 @@ inputs:
description: 'Extra command that will be executed for teardown work'
required: false
default: ''

compress_assets:
description: 'Compress assets before uploading'
required: false
Expand Down
4 changes: 3 additions & 1 deletion release.sh
Expand Up @@ -118,8 +118,10 @@ if [ ${INPUT_COMPRESS_ASSETS^^} == 'TRUE' ]; then
( shopt -s dotglob; tar cvfz ${RELEASE_ASSET_FILE} * )
fi
else
RELEASE_ASSET_FILE=${RELEASE_ASSET_NAME}
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}
fi
MD5_SUM=$(md5sum ${RELEASE_ASSET_FILE} | cut -d ' ' -f 1)
SHA256_SUM=$(sha256sum ${RELEASE_ASSET_FILE} | cut -d ' ' -f 1)
Expand Down