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
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ runs:
steps:
# https://docs.github.com/en/actions/sharing-automations/creating-actions/metadata-syntax-for-github-actions#runsstepsrun
- run: $GITHUB_ACTION_PATH/install.sh
if: runner.os != 'windows'
shell: bash
- run: . "$env:GITHUB_ACTION_PATH\install.ps1"
if: runner.os == 'windows'
shell: powershell
- name: add to path if windows
if: runner.os == 'windows'
shell: powershell
Expand Down
5 changes: 2 additions & 3 deletions install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $url = "https://github.com/you54f/pact-cli/releases/download/$tag/pact-cli-$arch


Write-Host "Downloading $url to $pactDir"
$exe = Join-Path $pactDir "pact-cli"
$exe = Join-Path $pactDir "pact-cli.exe"
if (Test-Path "$exe") {
Remove-Item $exe
}
Expand All @@ -34,5 +34,4 @@ Write-Host "--> Adding pact-cli to path"
$pactBinariesPath = "$pactDir"
$env:PATH += ";$pactBinariesPath"
Write-Host $env:PATH
Get-ChildItem $pactBinariesPath
pact-cli.exe --version
pact-cli.exe --help
25 changes: 18 additions & 7 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if [ "$tag" ]; then
fi

if command -v curl >/dev/null 2>&1; then
downloader="curl -sLO"
downloader="curl -sLO --fail"
elif command -v wget >/dev/null 2>&1; then
downloader="wget -q"
else
Expand All @@ -33,6 +33,10 @@ if [ -z "$PACT_CLI_VERSION" ]; then
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."
exit 1
fi
if [ -z "$PACT_CLI_VERSION" ]; then
PACT_CLI_VERSION=vlatest
echo "No version specified, defaulting to $PACT_CLI_VERSION"
fi

echo "Thanks for downloading the latest release of pact-cli $PACT_CLI_VERSION."
echo "-----"
Expand Down Expand Up @@ -107,20 +111,27 @@ case $os in
;;
esac

PROJECT_NAME=pact-cli
echo
echo "-------------"
echo "Downloading ${filename} - version ${PACT_CLI_VERSION}"
echo "-------------"
($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)
(chmod +x "${filename}" && echo unarchived "${filename}") || (echo "Sorry, you'll need to unarchived the pact-cli manually." && exit 1)
echo "pact-cli ${PACT_CLI_VERSION} installed to $(pwd)"
echo "Url: https://github.com/you54f/pact-cli/releases/download/${PACT_CLI_VERSION}/${filename}"
($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)
echo "$PROJECT_NAME ${PACT_CLI_VERSION} installed to $(pwd)"
echo "-------------------"
echo "available commands:"
echo "-------------------"
PROJECT_NAME=pact-cli
PACT_BROKER_CLI_BIN_PATH=${PWD}
mv $filename $PROJECT_NAME
chmod +x $PROJECT_NAME
if [[ "$filename" == *.exe ]]; then
mv "$filename" "$PROJECT_NAME.exe"
chmod +x "$PROJECT_NAME.exe"
else
mv "$filename" "$PROJECT_NAME"
chmod +x "$PROJECT_NAME"
fi
./pact-cli --help
echo "-------------------"
if [ "$GITHUB_ENV" ]; then
echo "Added the following to your path to make ${PROJECT_NAME} available:"
echo ""
Expand Down