-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
39 lines (39 loc) · 1.27 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
name: Setup jq
description: Simple GitHub Action to add jq to your path
inputs:
version:
description: Version of jq
default: 1.6
outputs:
path:
description: Absolute path to the jq binary
value: ${{ steps.jq.outputs.path }}
runs:
using: composite
steps:
- shell: bash
id: jq
run: |
if ${{ runner.os == 'Linux' }}; then
bin_name=jq-linux64
out_name=jq
action_path_unix=${GITHUB_ACTION_PATH}
elif ${{ runner.os == 'Windows' }}; then
bin_name=jq-win64.exe
out_name=jq.exe
action_path_unix=$(cygpath -u "${GITHUB_ACTION_PATH}")
wget() { powershell -command "wget ${@}"; }
elif ${{ runner.os == 'macOS' }}; then
bin_name=jq-osx-amd64
out_name=jq
action_path_unix=${GITHUB_ACTION_PATH}
else
exit 1
fi
mkdir ${action_path_unix}/jq
curl -L \
https://github.com/stedolan/jq/releases/download/jq-${{ inputs.version }}/${bin_name} \
-o "${GITHUB_ACTION_PATH}/jq/${out_name}"
chmod +x ${action_path_unix}/jq/${out_name}
echo ${action_path_unix}/jq >> ${GITHUB_PATH}
echo path='${{ github.action_path }}'/jq/${out_name} >> ${GITHUB_OUTPUT}