File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ name: Test action
22
33on :
44 push :
5+ pull_request :
56
67jobs :
78 test :
Original file line number Diff line number Diff line change @@ -17,6 +17,10 @@ The `isometry/setup-generic-tool` action is designed to make the use of generic
1717
1818** Optional** Override tool name, if it doesn't match the repo name
1919
20+ ### ` asset ` input
21+
22+ ** Optional** Override asset name, if it doesn't match the tool name
23+
2024### ` version ` input
2125
2226** Optional** Version of tool to install (default: ` latest ` ; example: ` v1.2.3 ` )
Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ inputs:
1010 description : Override tool name, if it doesn't match the repo name
1111 required : false
1212 default : " "
13+ asset :
14+ description : Override asset name, if it doesn't match the tool name
15+ required : false
16+ default : " "
1317 version :
1418 description : Version of tool to install
1519 required : false
3135 NAME : ${{ inputs.name }}
3236 VERSION : ${{ inputs.version }}
3337 TOOL : ${{ inputs.tool }}
38+ ASSET : ${{ inputs.asset }}
3439 run : |
35- "${GITHUB_ACTION_PATH}/setup.sh" "${NAME}" "${VERSION}" "${TOOL}"
40+ "${GITHUB_ACTION_PATH}/setup.sh" "${NAME}" "${VERSION}" "${TOOL}" "${ASSET}"
Original file line number Diff line number Diff line change @@ -31,13 +31,21 @@ IFS='/' read -r OWNER REPO <<< "${REPO_NAME}"
3131# Set tool name if not provided as third argument
3232TOOL_NAME=" ${3:- ${REPO} } "
3333
34+ ASSET_NAME_INPUT=" ${4:- ${TOOL_NAME} } "
35+
3436# Validate tool name
3537[[ ! " ${TOOL_NAME} " =~ ^[-A-Za-z0-9]+$ ]] && error " Invalid tool name"
3638
3739# Determine platform and architecture
3840PLATFORM=$( uname -s | tr ' [:upper:]' ' [:lower:]' )
3941ARCH=$( uname -m)
4042
43+ if [[ ${PLATFORM} == " darwin" ]]; then
44+ PLATFORM_PATTERN=" (darwin|macos)"
45+ else
46+ PLATFORM_PATTERN=" (${PLATFORM} )"
47+ fi
48+
4149# Convert architecture to common formats
4250case " ${ARCH} " in
4351 " aarch64" |" arm64" )
@@ -87,7 +95,7 @@ if [[ -d "${TOOL_CACHE_DIR}" ]]; then
8795 info " Found ${TOOL_NAME} ${VERSION} in ${TOOL_CACHE_DIR} "
8896else
8997 info " Searching for ${TOOL_NAME} ${VERSION} for ${PLATFORM} /${ARCH} "
90- ASSET_PATTERN=" ^${TOOL_NAME } .+${PLATFORM } .+${ARCH_PATTERN} ([.](tar[.]gz|zip))?\$ "
98+ ASSET_PATTERN=" ^${ASSET_NAME_INPUT } .+${PLATFORM_PATTERN } .+${ARCH_PATTERN} ([.](tar[.]gz|zip))?\$ "
9199 mapfile -t ASSETS < <( jq -r --arg pattern " ${ASSET_PATTERN} " ' .assets[] | select(.name | test($pattern; "i")) | .name' <<< " ${RELEASE_DATA}" )
92100
93101 : " ${ASSETS:? No matching release asset found} "
You can’t perform that action at this time.
0 commit comments