Skip to content

Commit a800a68

Browse files
committed
chore(win): update install script to retain exe suffix
1 parent 063d2ef commit a800a68

2 files changed

Lines changed: 20 additions & 10 deletions

File tree

install.ps1

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ $url = "https://github.com/you54f/pact-cli/releases/download/$tag/pact-cli-$arch
2020

2121

2222
Write-Host "Downloading $url to $pactDir"
23-
$exe = Join-Path $pactDir "pact-cli"
23+
$exe = Join-Path $pactDir "pact-cli.exe"
2424
if (Test-Path "$exe") {
2525
Remove-Item $exe
2626
}
@@ -34,5 +34,4 @@ Write-Host "--> Adding pact-cli to path"
3434
$pactBinariesPath = "$pactDir"
3535
$env:PATH += ";$pactBinariesPath"
3636
Write-Host $env:PATH
37-
Get-ChildItem $pactBinariesPath
38-
pact-cli.exe --version
37+
pact-cli.exe --help

install.sh

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ if [ "$tag" ]; then
1616
fi
1717

1818
if command -v curl >/dev/null 2>&1; then
19-
downloader="curl -sLO"
19+
downloader="curl -sLO --fail"
2020
elif command -v wget >/dev/null 2>&1; then
2121
downloader="wget -q"
2222
else
@@ -33,6 +33,10 @@ if [ -z "$PACT_CLI_VERSION" ]; then
3333
echo "Sorry, you need set a version number PACT_CLI_VERSION as we can't determine the latest at this time. See https://github.com/you54f/pact-cli/releases/latest."
3434
exit 1
3535
fi
36+
if [ -z "$PACT_CLI_VERSION" ]; then
37+
PACT_CLI_VERSION=vlatest
38+
echo "No version specified, defaulting to $PACT_CLI_VERSION"
39+
fi
3640

3741
echo "Thanks for downloading the latest release of pact-cli $PACT_CLI_VERSION."
3842
echo "-----"
@@ -107,20 +111,27 @@ case $os in
107111
;;
108112
esac
109113

114+
PROJECT_NAME=pact-cli
110115
echo
111116
echo "-------------"
112117
echo "Downloading ${filename} - version ${PACT_CLI_VERSION}"
113118
echo "-------------"
114-
($downloader https://github.com/you54f/pact-cli/releases/download/"${PACT_CLI_VERSION}"/"${filename}" && echo downloaded "${filename}") || (echo "Sorry, you'll need to install the pact-cli manually." && exit 1)
115-
(chmod +x "${filename}" && echo unarchived "${filename}") || (echo "Sorry, you'll need to unarchived the pact-cli manually." && exit 1)
116-
echo "pact-cli ${PACT_CLI_VERSION} installed to $(pwd)"
119+
echo "Url: https://github.com/you54f/pact-cli/releases/download/${PACT_CLI_VERSION}/${filename}"
120+
($downloader https://github.com/you54f/pact-cli/releases/download/"${PACT_CLI_VERSION}"/"${filename}" && echo downloaded "${filename}") || (echo "Failed to download pact-cli, check the version and url." && exit 1)
121+
echo "$PROJECT_NAME ${PACT_CLI_VERSION} installed to $(pwd)"
117122
echo "-------------------"
118123
echo "available commands:"
119124
echo "-------------------"
120-
PROJECT_NAME=pact-cli
121125
PACT_BROKER_CLI_BIN_PATH=${PWD}
122-
mv $filename $PROJECT_NAME
123-
chmod +x $PROJECT_NAME
126+
if [[ "$filename" == *.exe ]]; then
127+
mv "$filename" "$PROJECT_NAME.exe"
128+
chmod +x "$PROJECT_NAME.exe"
129+
else
130+
mv "$filename" "$PROJECT_NAME"
131+
chmod +x "$PROJECT_NAME"
132+
fi
133+
./pact-cli --help
134+
echo "-------------------"
124135
if [ "$GITHUB_ENV" ]; then
125136
echo "Added the following to your path to make ${PROJECT_NAME} available:"
126137
echo ""

0 commit comments

Comments
 (0)