Skip to content

Commit 2adc0d5

Browse files
authored
Allow version param to be latest (#61)
1 parent 66761d1 commit 2adc0d5

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

.circleci/test-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ workflows:
5555
matrix:
5656
parameters:
5757
executor: ["docker-x86-debian", "apple-silicon-14", "apple-silicon-15", "linuxvm-arm-ubuntu-2004", "linuxvm-x86-ubuntu-2004", "linuxvm-arm-ubuntu-2204", "linuxvm-x86-ubuntu-2204", "linuxvm-arm-ubuntu-2404", "linuxvm-x86-ubuntu-2404"]
58-
version: [2.27.0, 2.40.0] # 2.27.0 is the last version that uses ".tar.gz" instead of ".zip" for macOS
58+
version: [2.27.0, 2.40.0, "latest"] # 2.27.0 is the last version that uses ".tar.gz" instead of ".zip" for macOS
5959
- orb-tools/pack:
6060
filters: *release-filters
6161
- orb-tools/publish:

src/commands/install.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ description: Install the gh cli without authenticating or configuring. This comm
22
parameters:
33
version:
44
type: string
5-
default: "2.40.1"
6-
description: Specify the full semver versioned tag to use.
5+
default: "latest"
6+
description: Specify the full semver versioned tag to use. Default to latest.
77
when:
88
type: string
99
default: "on_success"

src/commands/setup.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ description: Install and authenticate with the gh cli. This command should be ru
22
parameters:
33
version:
44
type: string
5-
default: "2.40.1"
6-
description: Specify the full semver versioned tag to use.
5+
default: "latest"
6+
description: Specify the full semver versioned tag to use. Default to latest.
77
hostname:
88
type: string
99
default: "github.com"

src/jobs/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ parameters:
3333
default: ""
3434
version:
3535
type: string
36-
default: "2.3.0"
37-
description: Specify the full semver versioned tag to use for the GitHub CLI installation.
36+
default: "latest"
37+
description: Specify the full semver versioned tag to use for the GitHub CLI installation. Default to latest.
3838
additional_args:
3939
type: string
4040
default: ""

src/scripts/install.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ detect_platform() {
3131
download_gh_cli() {
3232
local platform=$1
3333
local file_extension=$2
34+
if [ "$PARAM_GH_CLI_VERSION" = "latest" ]; then
35+
LATEST_TAG=$(curl url -s https://api.github.com/repos/cli/cli/releases/latest | jq -r '.tag_name')
36+
PARAM_GH_CLI_VERSION="${LATEST_TAG#v}"
37+
fi
3438
local download_url="https://github.com/cli/cli/releases/download/v${PARAM_GH_CLI_VERSION}/gh_${PARAM_GH_CLI_VERSION}_${platform}.${file_extension}"
3539
echo "Downloading the GitHub CLI from \"$download_url\"..."
3640

0 commit comments

Comments
 (0)