Skip to content

Commit 220df9d

Browse files
authored
Merge pull request #1058 from github/ellismg/support-prerelease-for-install-sh
Allow installing prerelease CLI with `install.sh`
2 parents 8e1fb04 + bc44fc1 commit 220df9d

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

install.sh

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,31 @@ case "$(uname -m)" in
3535
esac
3636

3737
# Determine download URL based on VERSION
38-
if [ -n "$VERSION" ]; then
38+
if [ "${VERSION}" = "latest" ] || [ -z "$VERSION" ]; then
39+
DOWNLOAD_URL="https://github.com/github/copilot-cli/releases/latest/download/copilot-${PLATFORM}-${ARCH}.tar.gz"
40+
CHECKSUMS_URL="https://github.com/github/copilot-cli/releases/latest/download/SHA256SUMS.txt"
41+
elif [ "${VERSION}" = "prerelease" ]; then
42+
# Get the latest prerelease tag
43+
if ! command -v git >/dev/null 2>&1; then
44+
echo "Error: git is required to install prerelease versions" >&2
45+
exit 1
46+
fi
47+
VERSION="$(git ls-remote --tags https://github.com/github/copilot-cli | tail -1 | awk -F/ '{print $NF}')"
48+
if [ -z "$VERSION" ]; then
49+
echo "Error: Could not determine prerelease version" >&2
50+
exit 1
51+
fi
52+
echo "Latest prerelease version: $VERSION"
53+
DOWNLOAD_URL="https://github.com/github/copilot-cli/releases/download/${VERSION}/copilot-${PLATFORM}-${ARCH}.tar.gz"
54+
CHECKSUMS_URL="https://github.com/github/copilot-cli/releases/download/${VERSION}/SHA256SUMS.txt"
55+
else
3956
# Prefix version with 'v' if not already present
4057
case "$VERSION" in
4158
v*) ;;
4259
*) VERSION="v$VERSION" ;;
4360
esac
4461
DOWNLOAD_URL="https://github.com/github/copilot-cli/releases/download/${VERSION}/copilot-${PLATFORM}-${ARCH}.tar.gz"
4562
CHECKSUMS_URL="https://github.com/github/copilot-cli/releases/download/${VERSION}/SHA256SUMS.txt"
46-
else
47-
DOWNLOAD_URL="https://github.com/github/copilot-cli/releases/latest/download/copilot-${PLATFORM}-${ARCH}.tar.gz"
48-
CHECKSUMS_URL="https://github.com/github/copilot-cli/releases/latest/download/SHA256SUMS.txt"
4963
fi
5064
echo "Downloading from: $DOWNLOAD_URL"
5165

0 commit comments

Comments
 (0)