Skip to content

Commit ed085cb

Browse files
committed
Ensured github cli install is multiplatform
1 parent ea90a6b commit ed085cb

File tree

5 files changed

+74
-5
lines changed

5 files changed

+74
-5
lines changed

.github/workflows/ci-cd-dispatcher.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,19 @@ jobs:
179179
fetch-depth: 1
180180

181181
- name: Install GitHub CLI
182-
run: sudo apt-get install gh -y
182+
shell: bash
183+
run: |
184+
if command -v gh &> /dev/null; then
185+
echo "GitHub CLI already installed."
186+
elif [[ "$RUNNER_OS" == "Linux" ]]; then
187+
sudo apt-get update
188+
sudo apt-get install gh -y
189+
elif [[ "$RUNNER_OS" == "macOS" ]]; then
190+
brew install gh
191+
else
192+
echo "Please ensure GitHub CLI is installed on your Windows runner." >&2
193+
exit 1
194+
fi
183195
184196
- name: Call CI/CD Pipeline from GitHub CLI
185197
env:

.github/workflows/ci-cd-redeployer.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,26 @@ jobs:
5151
validate_release:
5252
name: Validate Release Tag and Artifacts
5353
runs-on: ${{ inputs.runnerMain }}
54+
defaults:
55+
run:
56+
shell: bash
5457
outputs:
5558
hasCombinedArtifacts: ${{ steps.check.outputs.hasCombinedArtifacts }}
5659
steps:
5760
- name: Install GitHub CLI
58-
run: sudo apt-get install gh -y
61+
shell: bash
62+
run: |
63+
if command -v gh &> /dev/null; then
64+
echo "GitHub CLI already installed."
65+
elif [[ "$RUNNER_OS" == "Linux" ]]; then
66+
sudo apt-get update
67+
sudo apt-get install gh -y
68+
elif [[ "$RUNNER_OS" == "macOS" ]]; then
69+
brew install gh
70+
else
71+
echo "Please ensure GitHub CLI is installed on your Windows runner." >&2
72+
exit 1
73+
fi
5974
6075
- name: Check GitHub Release Exists and Artifacts
6176
id: check

.github/workflows/test-step-4-deploy-workflow.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,27 @@ jobs:
5757
validate_release:
5858
name: Validate Release Tag and Artifacts
5959
runs-on: ${{ inputs.runnerMain }}
60+
defaults:
61+
run:
62+
shell: bash
6063
if: ${{ inputs.artifactSource == 'release' }}
6164
outputs:
6265
hasCombinedArtifacts: ${{ steps.check.outputs.hasCombinedArtifacts }}
6366
steps:
6467
- name: Install GitHub CLI
65-
run: sudo apt-get install gh -y
68+
shell: bash
69+
run: |
70+
if command -v gh &> /dev/null; then
71+
echo "GitHub CLI already installed."
72+
elif [[ "$RUNNER_OS" == "Linux" ]]; then
73+
sudo apt-get update
74+
sudo apt-get install gh -y
75+
elif [[ "$RUNNER_OS" == "macOS" ]]; then
76+
brew install gh
77+
else
78+
echo "Please ensure GitHub CLI is installed on your Windows runner." >&2
79+
exit 1
80+
fi
6681
6782
- name: Check GitHub Release Exists and Artifacts
6883
id: check

CICD_Workflows/ci-cd-dispatcher.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,19 @@ jobs:
172172
fetch-depth: 1
173173

174174
- name: Install GitHub CLI
175-
run: sudo apt-get install gh -y
175+
shell: bash
176+
run: |
177+
if command -v gh &> /dev/null; then
178+
echo "GitHub CLI already installed."
179+
elif [[ "$RUNNER_OS" == "Linux" ]]; then
180+
sudo apt-get update
181+
sudo apt-get install gh -y
182+
elif [[ "$RUNNER_OS" == "macOS" ]]; then
183+
brew install gh
184+
else
185+
echo "Please ensure GitHub CLI is installed on your Windows runner." >&2
186+
exit 1
187+
fi
176188
177189
- name: Call CI/CD Pipeline from GitHub CLI
178190
env:

CICD_Workflows/ci-cd-redeployer.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,26 @@ jobs:
5151
validate_release:
5252
name: Validate Release Tag and Artifacts
5353
runs-on: ${{ inputs.runnerMain }}
54+
defaults:
55+
run:
56+
shell: bash
5457
outputs:
5558
hasCombinedArtifacts: ${{ steps.check.outputs.hasCombinedArtifacts }}
5659
steps:
5760
- name: Install GitHub CLI
58-
run: sudo apt-get install gh -y
61+
shell: bash
62+
run: |
63+
if command -v gh &> /dev/null; then
64+
echo "GitHub CLI already installed."
65+
elif [[ "$RUNNER_OS" == "Linux" ]]; then
66+
sudo apt-get update
67+
sudo apt-get install gh -y
68+
elif [[ "$RUNNER_OS" == "macOS" ]]; then
69+
brew install gh
70+
else
71+
echo "Please ensure GitHub CLI is installed on your Windows runner." >&2
72+
exit 1
73+
fi
5974
6075
- name: Check GitHub Release Exists and Artifacts
6176
id: check

0 commit comments

Comments
 (0)