-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaction.yml
More file actions
70 lines (62 loc) · 2.47 KB
/
Copy pathaction.yml
File metadata and controls
70 lines (62 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: pact
description: Install the Pact consolidated CLI (mock server, verifier, stub server, plugin and broker tools in a single binary).
inputs:
version:
description: >-
Deprecated. Pin the version via the action ref instead:
uses: pact-foundation/pact-cli@vX.Y.Z
required: false
default: ''
deprecationMessage: >-
The 'version' input is deprecated. Pin the version via the action ref instead:
uses: pact-foundation/pact-cli@vX.Y.Z
runs:
using: "composite"
steps:
- name: Install pact (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
EXPLICIT_VERSION="${{ inputs.version }}"
ACTION_REF="${{ github.action_ref }}"
if [ -n "$EXPLICIT_VERSION" ] && [ "$EXPLICIT_VERSION" != "vlatest" ]; then
RESOLVED_VERSION="$EXPLICIT_VERSION"
elif echo "$ACTION_REF" | grep -qE '^v[0-9]+\.[0-9]+\.[0-9]'; then
RESOLVED_VERSION="$ACTION_REF"
else
RESOLVED_VERSION=""
fi
if [ -z "$RESOLVED_VERSION" ]; then
URL="https://github.com/pact-foundation/pact-cli/releases/latest/download/pact-installer.sh"
else
URL="https://github.com/pact-foundation/pact-cli/releases/download/${RESOLVED_VERSION}/pact-installer.sh"
fi
curl --proto '=https' --tlsv1.2 -LsSf "$URL" | sh
- name: Install pact (Windows)
if: runner.os == 'Windows'
shell: powershell
run: |
$explicitVersion = "${{ inputs.version }}"
$actionRef = "${{ github.action_ref }}"
if (-not [string]::IsNullOrEmpty($explicitVersion) -and $explicitVersion -ne "vlatest") {
$resolvedVersion = $explicitVersion
} elseif ($actionRef -match '^v\d+\.\d+\.\d+') {
$resolvedVersion = $actionRef
} else {
$resolvedVersion = ""
}
if ([string]::IsNullOrEmpty($resolvedVersion)) {
$url = "https://github.com/pact-foundation/pact-cli/releases/latest/download/pact-installer.ps1"
} else {
$url = "https://github.com/pact-foundation/pact-cli/releases/download/$resolvedVersion/pact-installer.ps1"
}
irm $url | iex
- name: Add pact bin to PATH (Unix)
if: runner.os != 'Windows'
shell: bash
run: echo "$HOME/.pact/bin" >> "$GITHUB_PATH"
- name: Add pact bin to PATH (Windows)
if: runner.os == 'Windows'
shell: powershell
run: |
Add-Content -Path $env:GITHUB_PATH -Value "$env:USERPROFILE\.pact\bin"