Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,17 @@ jobs:
- os: macos-latest
checksums: sha256,sha512,sha1,md5
- os: macos-latest
checksums: sha256,sha512,sha1,md5
checksums: |
sha256
sha512
sha1
md5
target: x86_64-apple-darwin
- os: macos-latest
checksums: sha256,sha512,sha1,md5
checksums: sha256 sha512 sha1 md5
target: aarch64-apple-darwin
- os: macos-latest
checksums: sha256,sha512,sha1,md5
checksums: sha256, sha512, sha1, md5
target: universal-apple-darwin
- os: macos-latest
checksums: sha256,sha512,sha1,md5
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com

## [Unreleased]

- `bin`, `checksum`, `include`, and `asset` input options now support whitespace (space, tab, and line) or comma separated list. Previously, only comma-separated list was supported. ([#111](https://github.com/taiki-e/upload-rust-binary-action/pull/111))

## [1.27.0] - 2025-06-14

- Add `package` input option. ([#103](https://github.com/taiki-e/upload-rust-binary-action/pull/103), thanks @A4-Tacks)
Expand Down
38 changes: 19 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,20 @@ Currently, this action is basically intended to be used in combination with an a

| Name | Required | Description | Type | Default |
| ---- | :------: | ----------- | ---- | ------- |
| bin | **✓** | Comma-separated list of binary names (non-extension portion of filename) to build and upload | String | |
| bin | **✓** | Binary names (non-extension portion of filename) to build and upload (whitespace or comma separated list) | String | |
| token | **✓** \[1] | GitHub token for creating GitHub Releases (see [action.yml](action.yml) for more) | String | |
| archive | | Archive name (non-extension portion of filename) to be uploaded | String | `$bin-$target` |
| target | \[2] | Target triple, default is host triple | String | (host triple) |
| features | | Comma-separated list of cargo build features to enable | String | |
| features | | Cargo build features to enable (space or comma separated list) | String | |
| package | | Package name to build | String | |
| no-default-features | | Whether to disable cargo build default features | Boolean | `false` |
| locked | | Whether to build with `--locked` flag | Boolean | `false` |
| tar | | On which platform to distribute the `.tar.gz` file (all, unix, windows, or none) | String | `unix` |
| tar-xz | | On which platform to distribute the `.tar.xz` file (all, unix, windows, or none) | String | `none` |
| zip | | On which platform to distribute the `.zip` file (all, unix, windows, or none) | String | `windows` |
| checksum | | Comma-separated list of algorithms to be used for checksum (b2, sha256, sha512, sha1, or md5).<br>Note: b2 is not available by default on macOS, install `b2sum` to use it. | String | |
| include | | Comma-separated list of additional files to be included to the archive | String | |
| asset | | Comma-separated list of additional files to be uploaded separately | String | |
| checksum | | Algorithms to be used for checksum (b2, sha256, sha512, sha1, or md5) (whitespace or comma separated list).<br>Note: b2 is not available by default on macOS, install `b2sum` to use it. | String | |
| include | | Additional files to be included to the archive (whitespace or comma separated list) | String | |
| asset | | Additional files to be uploaded separately (whitespace or comma separated list) | String | |
| leading-dir | | Whether to create the leading directory in the archive or not | Boolean | `false` |
| bin-leading-dir | | Create extra leading directory(s) for binary file(s) specified by `bin` option | String | |
| build-tool | | Tool to build binaries (cargo, cross, or cargo-zigbuild, see [cross-compilation example](#example-workflow-cross-compilation) for more) | String | |
Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:
- uses: actions/checkout@v4
- uses: taiki-e/upload-rust-binary-action@v1
with:
# (required) Comma-separated list of binary names (non-extension portion of filename) to build and upload.
# (required) Binary names (non-extension portion of filename) to build and upload (whitespace or comma separated list).
# Note that glob pattern is not supported yet.
bin: ...
# (required) GitHub token for uploading assets to GitHub Releases.
Expand All @@ -131,7 +131,7 @@ You can specify multiple binaries when the root manifest is a virtual manifest o
```yaml
- uses: taiki-e/upload-rust-binary-action@v1
with:
# (required) Comma-separated list of binary names (non-extension portion of filename) to build and upload.
# (required) Binary names (non-extension portion of filename) to build and upload (whitespace or comma separated list).
# Note that glob pattern is not supported yet.
bin: app1,app2
# (optional) Archive name (non-extension portion of filename) to be uploaded.
Expand Down Expand Up @@ -193,7 +193,7 @@ jobs:
- uses: actions/checkout@v4
- uses: taiki-e/upload-rust-binary-action@v1
with:
# (required) Comma-separated list of binary names (non-extension portion of filename) to build and upload.
# (required) Binary names (non-extension portion of filename) to build and upload (whitespace or comma separated list).
# Note that glob pattern is not supported yet.
bin: ...
# (optional) Target triple, default is host triple.
Expand Down Expand Up @@ -309,7 +309,7 @@ jobs:
- uses: actions/checkout@v4
- uses: taiki-e/upload-rust-binary-action@v1
with:
# (required) Comma-separated list of binary names (non-extension portion of filename) to build and upload.
# (required) Binary names (non-extension portion of filename) to build and upload (whitespace or comma separated list).
# Note that glob pattern is not supported yet.
bin: ...
# (optional) Target triple, default is host triple.
Expand Down Expand Up @@ -380,7 +380,7 @@ jobs:
- uses: actions/checkout@v4
- uses: taiki-e/upload-rust-binary-action@v1
with:
# (required) Comma-separated list of binary names (non-extension portion of filename) to build and upload.
# (required) Binary names (non-extension portion of filename) to build and upload (whitespace or comma separated list).
# Note that glob pattern is not supported yet.
bin: ...
# (optional) Target triple, default is host triple.
Expand Down Expand Up @@ -441,7 +441,7 @@ jobs:
if: startsWith(matrix.os, 'ubuntu')
- uses: taiki-e/upload-rust-binary-action@v1
with:
# (required) Comma-separated list of binary names (non-extension portion of filename) to build and upload.
# (required) Binary names (non-extension portion of filename) to build and upload (whitespace or comma separated list).
# Note that glob pattern is not supported yet.
bin: ...
# (optional) Target triple, default is host triple.
Expand Down Expand Up @@ -540,10 +540,10 @@ jobs:
- uses: actions/checkout@v4
- uses: taiki-e/upload-rust-binary-action@v1
with:
# (required) Comma-separated list of binary names (non-extension portion of filename) to build and upload.
# (required) Binary names (non-extension portion of filename) to build and upload (whitespace or comma separated list).
# Note that glob pattern is not supported yet.
bin: ...
# (optional) Comma-separated list of additional files to be included to archive.
# (optional) Additional files to be included to the archive (whitespace or comma separated list).
# Note that glob pattern is not supported yet.
include: LICENSE,README.md
# (required) GitHub token for uploading assets to GitHub Releases.
Expand All @@ -563,10 +563,10 @@ You can use the `leading-dir` option to create the leading directory.
```yaml
- uses: taiki-e/upload-rust-binary-action@v1
with:
# (required) Comma-separated list of binary names (non-extension portion of filename) to build and upload.
# (required) Binary names (non-extension portion of filename) to build and upload (whitespace or comma separated list).
# Note that glob pattern is not supported yet.
bin: ...
# (optional) Comma-separated list of additional files to be included to archive.
# (optional) Additional files to be included to the archive (whitespace or comma separated list).
# Note that glob pattern is not supported yet.
include: LICENSE,README.md
# (optional) Whether to create the leading directory in the archive or not. default to false.
Expand All @@ -589,10 +589,10 @@ You can use the `bin-leading-dir` option to create extra leading directory(s) fo
```yaml
- uses: taiki-e/upload-rust-binary-action@v1
with:
# (required) Comma-separated list of binary names (non-extension portion of filename) to build and upload.
# (required) Binary names (non-extension portion of filename) to build and upload (whitespace or comma separated list).
# Note that glob pattern is not supported yet.
bin: ...
# (optional) Comma-separated list of additional files to be included to archive.
# (optional) Additional files to be included to the archive (whitespace or comma separated list).
# Note that glob pattern is not supported yet.
include: LICENSE,README.md
# (optional) Whether to create the leading directory in the archive or not. default to false.
Expand Down Expand Up @@ -621,10 +621,10 @@ upload-assets:
- uses: actions/checkout@v4
- uses: taiki-e/upload-rust-binary-action@v1
with:
# (required) Comma-separated list of binary names (non-extension portion of filename) to build and upload.
# (required) Binary names (non-extension portion of filename) to build and upload (whitespace or comma separated list).
# Note that glob pattern is not supported yet.
bin: ...
# (optional) Comma-separated list of additional files to be uploaded separately.
# (optional) Additional files to be uploaded separately (whitespace or comma separated list).
# Note that glob pattern is not supported yet.
asset: LICENSE,README.md
# (required) GitHub token for uploading assets to GitHub Releases.
Expand Down
10 changes: 5 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: GitHub Action for building and uploading Rust binary to GitHub Rele
inputs:
bin:
description: >
Comma-separated list of binary names (non-extension portion of filename) to build and upload.
Binary names (non-extension portion of filename) to build and upload (whitespace or comma separated list).
Note that glob pattern is not supported yet.
required: true
archive:
Expand All @@ -15,7 +15,7 @@ inputs:
description: Target name, default is host triple
required: false
features:
description: Comma-separated list of cargo build features to enable
description: Cargo build features to enable (space or comma separated list)
required: false
package:
description: Package name to build
Expand Down Expand Up @@ -51,12 +51,12 @@ inputs:
default: 'windows'
include:
description: >
Comma-separated list of additional files to be included to archive.
Additional files to be included to the archive (whitespace or comma separated list).
Note that glob pattern is not supported yet.
required: false
asset:
description: >
Comma-separated list of additional files to be uploaded separately.
Additional files to be uploaded separately (whitespace or comma separated list).
Note that glob pattern is not supported yet.
required: false
leading-dir:
Expand All @@ -76,7 +76,7 @@ inputs:
description: Alias for 'build-tool'
required: false
checksum:
description: Comma-separated list of algorithms to be used for checksum (b2, sha256, sha512, sha1, or md5)
description: Algorithms to be used for checksum (b2, sha256, sha512, sha1, or md5) (whitespace or comma separated list)
required: false
token:
description: >
Expand Down
21 changes: 17 additions & 4 deletions main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ warn() {
info() {
printf >&2 'info: %s\n' "$*"
}
normalize_comma_or_space_separated() {
# Normalize whitespace characters into space because it's hard to handle single input contains lines with POSIX sed alone.
local list="${1//[$'\r\n\t']/ }"
if [[ "${list}" == *","* ]]; then
# If a comma is contained, consider it is a comma-separated list.
# Drop leading and trailing whitespaces in each element.
sed -E 's/ *, */,/g; s/^.//' <<<",${list},"
else
# Otherwise, consider it is a whitespace-separated list.
# Convert whitespace characters into comma.
sed -E 's/ +/,/g; s/^.//' <<<" ${list} "
fi
}

export CARGO_NET_RETRY=10
export RUSTUP_MAX_RETRIES=10
Expand Down Expand Up @@ -130,7 +143,7 @@ if [[ -n "${bin_name}" ]]; then
fi
while read -rd,; do
bin_names+=("${REPLY}")
done <<<"${bin_name},"
done < <(normalize_comma_or_space_separated "${bin_name}")
fi
if [[ ${#bin_names[@]} -gt 1 ]] && [[ "${archive}" == *"\$bin"* ]]; then
bail "when multiple binary names are specified, default archive name or '\$bin' variable cannot be used in 'archive' option"
Expand All @@ -149,7 +162,7 @@ if [[ -n "${include}" ]]; then
fi
while read -rd,; do
includes+=("${REPLY}")
done <<<"${include},"
done < <(normalize_comma_or_space_separated "${include}")
fi

asset="${INPUT_ASSET:-}"
Expand All @@ -165,7 +178,7 @@ if [[ -n "${asset}" ]]; then
fi
while read -rd,; do
assets+=("${REPLY}")
done <<<"${asset},"
done < <(normalize_comma_or_space_separated "${asset}")
fi

checksum="${INPUT_CHECKSUM:-}"
Expand All @@ -177,7 +190,7 @@ if [[ -n "${checksum}" ]]; then
b2 | sha256 | sha512 | sha1 | md5) ;;
*) bail "'checksum' input option must be 'b2', 'sha256', 'sha512', 'sha1', or 'md5': '${REPLY}'" ;;
esac
done <<<"${checksum},"
done < <(normalize_comma_or_space_separated "${checksum}")
fi

host=$(rustc -vV | grep -E '^host:' | cut -d' ' -f2)
Expand Down
Loading