-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
45 lines (45 loc) · 1.68 KB
/
action.yml
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
name: Setup GitHub CLI
description: Simple GitHub Action to add the GitHub CLI (gh) to your path
inputs:
version:
description: Version of gh
default: 2.13.0
outputs:
path:
description: Absolute path to the gh binary
value: ${{ steps.gh.outputs.path }}
runs:
using: composite
steps:
- shell: bash
id: gh
run: |
if ${{ runner.os == 'Linux' }}; then
file_name=gh_${{ inputs.version }}_linux_amd64.tar.gz
out_name=${file_name%.tar.gz}/bin/gh
action_path_unix=${{ github.action_path }}
elif ${{ runner.os == 'Windows' }}; then
file_name=gh_${{ inputs.version }}_windows_amd64.zip
out_name=bin/gh.exe
action_path_unix=$(cygpath -u '${{ github.action_path }}')
wget() { powershell -command "wget ${@}"; }
elif ${{ runner.os == 'macOS' }}; then
file_name=gh_${{ inputs.version }}_macOS_amd64.tar.gz
out_name=${file_name%.tar.gz}/bin/gh
action_path_unix=${{ github.action_path }}
else
echo "Unknown runner OS \"${{ runner.os }}\""
exit 1
fi
mkdir ${action_path_unix}/gh
cd ${action_path_unix}/gh
wget \
https://github.com/cli/cli/releases/download/v${{ inputs.version }}/${file_name} \
-O ${file_name}
if ${{ runner.os == 'Linux' || runner.os == 'macOS' }}; then
tar xf ${file_name}
else
unzip ${file_name}
fi
echo ${action_path_unix}/gh/$(dirname ${out_name}) >> ${GITHUB_PATH}
echo ::set-output name=path::'${{ github.action_path }}'/gh/${out_name}