action.yml RawHistoryFolder
1name: 'Setup Gordon'
2description: 'Install the Gordon CLI binary into the runner PATH'
3author: 'Gordon Contributors'
4
5branding:
6 icon: 'download-cloud'
7 color: 'blue'
8
9inputs:
10 version:
11 description: 'Gordon version to install (e.g. v2.0.0 or latest)'
12 required: false
13 default: 'latest'
14
15outputs:
16 version:
17 description: 'The version of Gordon that was installed'
18 value: ${{ steps.install.outputs.version }}
19 path:
20 description: 'Path to the installed Gordon binary'
21 value: ${{ steps.install.outputs.path }}
22
23runs:
24 using: 'composite'
25 steps:
26 - name: Install Gordon
27 id: install
28 shell: bash
29 run: |
30 set -euo pipefail
31
32 # Map RUNNER_OS to gordon OS identifier
33 case "${RUNNER_OS}" in
34 Linux) os="linux" ;;
35 macOS) os="darwin" ;;
36 *) echo "Unsupported OS: ${RUNNER_OS}" >&2; exit 1 ;;
37 esac
38
39 # Map RUNNER_ARCH to gordon arch identifier
40 case "${RUNNER_ARCH}" in
41 X64) arch="amd64" ;;
42 ARM64) arch="arm64" ;;
43 *) echo "Unsupported architecture: ${RUNNER_ARCH}" >&2; exit 1 ;;
44 esac
45
46 version="${{ inputs.version }}"
47
48 # Resolve 'latest' to an actual tag via redirect URL
49 if [ "${version}" = "latest" ]; then
50 redirect_url="$(curl -fsSL -o /dev/null -w '%{redirect_url}' "https://github.com/bnema/gordon/releases/latest")"
51 version="${redirect_url##*/}"
52 if [ -z "${version}" ]; then
53 echo "Failed to resolve latest Gordon version" >&2
54 exit 1
55 fi
56 fi
57
58 archive="gordon_${os}_${arch}.tar.gz"
59 url="https://github.com/bnema/gordon/releases/download/${version}/${archive}"
60 dest="/tmp/${archive}"
61 install_path="/usr/local/bin/gordon"
62
63 echo "Installing Gordon ${version} (${os}/${arch}) from ${url}"
64
65 # Download the release archive
66 curl -fsSL -o "${dest}" "${url}"
67
68 # Extract just the gordon binary and clean up
69 tar -xzf "${dest}" -C /usr/local/bin/ gordon
70 rm -f "${dest}"
71
72 # Make executable and verify
73 chmod +x "${install_path}"
74 gordon version
75
76 # Set outputs
77 echo "version=${version}" >> "${GITHUB_OUTPUT}"
78 echo "path=${install_path}" >> "${GITHUB_OUTPUT}"