Skip to content

Commit

Permalink
Touch up PR 44
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed May 13, 2023
1 parent ccae301 commit 470c0ba
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
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]

- Add `profile` input option to allow specifying custom profiles. ([#44](https://github.com/taiki-e/upload-rust-binary-action/pull/44), thanks @afnanenayet)

## [1.13.0] - 2023-03-22

- Switch to composite action ([#42](https://github.com/taiki-e/upload-rust-binary-action/pull/42))
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Currently, this action is basically intended to be used in combination with an a
| build_tool | false | Tool to build binaries (cargo or cross, see [cross-compilation example](#example-workflow-cross-compilation) for more) | String | |
| ref | false | Fully-formed tag ref for this release (see [action.yml](action.yml) for more) | String | |
| manifest_path | false | Path to Cargo.toml | String | `Cargo.toml` |
| profile | false | The cargo profile to build. This defaults to the release profile. | String | `release` |

[^1]: Required one of `token` input option or `GITHUB_TOKEN` environment variable.

Expand Down
26 changes: 9 additions & 17 deletions main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -168,28 +168,20 @@ case "${OSTYPE}" in
esac

input_profile=${INPUT_PROFILE:-release}

declare -a build_options=()

if [[ -n "${input_profile}" ]]; then
build_options+=("--profile" "${input_profile}")
else
build_options+=("--release")
fi
case "${input_profile}" in
release) build_options=("--release") ;;
*) build_options=("--profile" "${input_profile}") ;;
esac

# There are some special profiles that correspond to different target directory
# names. If we don't hit one of those conditionals then we just use the profile
# name.
# See: https://doc.rust-lang.org/nightly/cargo/reference/profiles.html#custom-profiles
profile_directory=${input_profile}

if [[ ${input_profile} = "bench" ]]; then
profile_directory="release"
elif [[ ${input_profile} = "dev" ]]; then
profile_directory="debug"
elif [[ ${input_profile} = "test" ]]; then
profile_directory="debug"
fi
case "${input_profile}" in
bench) profile_directory="release" ;;
dev | test) profile_directory="debug" ;;
*) profile_directory=${input_profile} ;;
esac

bins=()
for bin_name in "${bin_names[@]}"; do
Expand Down

0 comments on commit 470c0ba

Please sign in to comment.