mirror of
https://github.com/dcarbone/install-jq-action.git
synced 2026-02-12 11:06:55 +08:00
Compare commits
39 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7ef57d46e | ||
|
|
2eac2baa38 | ||
|
|
f0e10f46ff | ||
|
|
8f16b8ad5b | ||
|
|
26514abd65 | ||
|
|
4e6d52de30 | ||
|
|
8fd607321d | ||
|
|
e397bd8743 | ||
|
|
36b228ee68 | ||
|
|
d5935278d5 | ||
|
|
ca8101273e | ||
|
|
de7c0d1fb1 | ||
|
|
8867ddb478 | ||
|
|
945d84920f | ||
|
|
1090b8bd11 | ||
|
|
ff922c75b7 | ||
|
|
7f4d6f4833 | ||
|
|
bfb9fa8e7d | ||
|
|
c1548c666d | ||
|
|
f07422da1e | ||
|
|
183bc8df0e | ||
|
|
f6b58bacfe | ||
|
|
8a48eeaec5 | ||
|
|
4fd1c2fa17 | ||
|
|
d6095dd111 | ||
|
|
f4380feee9 | ||
|
|
013545576e | ||
|
|
58f2b9e47b | ||
|
|
ff3e63d085 | ||
|
|
d01a60fdb7 | ||
|
|
b628dd299f | ||
|
|
c8104cea13 | ||
|
|
aa4e9171a2 | ||
|
|
be73239910 | ||
|
|
360494bdc8 | ||
|
|
6edf1e1259 | ||
|
|
22c3fc1e13 | ||
|
|
91d8da7268 | ||
|
|
2729c7570f |
6
.github/dependabot.yml
vendored
Normal file
6
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
9
.github/workflows/example-linux.yaml
vendored
9
.github/workflows/example-linux.yaml
vendored
@@ -6,12 +6,12 @@ on:
|
||||
version:
|
||||
type: string
|
||||
required: false
|
||||
description: "Version of jq to install"
|
||||
default: "1.6"
|
||||
description: 'Version of jq to install'
|
||||
default: '1.7.1'
|
||||
force:
|
||||
type: boolean
|
||||
required: false
|
||||
description: "Do not check for existing jq installation before continuing."
|
||||
description: 'Do not check for existing jq installation before continuing.'
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
@@ -19,12 +19,13 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 'Setup jq'
|
||||
uses: dcarbone/install-jq-action@v1.0.0
|
||||
uses: dcarbone/install-jq-action@v3
|
||||
with:
|
||||
version: '${{ inputs.version }}'
|
||||
force: '${{ inputs.force }}'
|
||||
|
||||
- name: 'Check jq'
|
||||
# language=sh
|
||||
run: |
|
||||
which jq
|
||||
jq --version
|
||||
|
||||
9
.github/workflows/example-macos.yaml
vendored
9
.github/workflows/example-macos.yaml
vendored
@@ -6,12 +6,12 @@ on:
|
||||
version:
|
||||
type: string
|
||||
required: false
|
||||
description: "Version of jq to install"
|
||||
default: "1.6"
|
||||
description: 'Version of jq to install'
|
||||
default: '1.7.1'
|
||||
force:
|
||||
type: boolean
|
||||
required: false
|
||||
description: "Do not check for existing jq installation before continuing."
|
||||
description: 'Do not check for existing jq installation before continuing.'
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
@@ -19,12 +19,13 @@ jobs:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: 'Setup jq'
|
||||
uses: dcarbone/install-jq-action@v1.0.0
|
||||
uses: dcarbone/install-jq-action@v3
|
||||
with:
|
||||
version: '${{ inputs.version }}'
|
||||
force: '${{ inputs.force }}'
|
||||
|
||||
- name: 'Check jq'
|
||||
# language=sh
|
||||
run: |
|
||||
which jq
|
||||
jq --version
|
||||
|
||||
9
.github/workflows/example-windows.yaml
vendored
9
.github/workflows/example-windows.yaml
vendored
@@ -6,12 +6,12 @@ on:
|
||||
version:
|
||||
type: string
|
||||
required: false
|
||||
description: "Version of jq to install"
|
||||
default: "1.6"
|
||||
description: 'Version of jq to install'
|
||||
default: '1.7.1'
|
||||
force:
|
||||
type: boolean
|
||||
required: false
|
||||
description: "Do not check for existing jq installation before continuing."
|
||||
description: 'Do not check for existing jq installation before continuing.'
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
@@ -19,12 +19,13 @@ jobs:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: 'Setup jq'
|
||||
uses: dcarbone/install-jq-action@v1.0.0
|
||||
uses: dcarbone/install-jq-action@v3
|
||||
with:
|
||||
version: '${{ inputs.version }}'
|
||||
force: '${{ inputs.force }}'
|
||||
|
||||
- name: 'Check jq'
|
||||
# language=powershell
|
||||
run: |
|
||||
Get-Command "jq.exe"
|
||||
jq.exe --version
|
||||
|
||||
234
.github/workflows/tests.yaml
vendored
234
.github/workflows/tests.yaml
vendored
@@ -10,7 +10,9 @@ on:
|
||||
- 'action.yaml'
|
||||
- '.github/workflows/tests.yaml'
|
||||
- 'scripts/unixish.sh'
|
||||
- 'scripts/unixish-17.sh'
|
||||
- 'scripts/windowsish.ps1'
|
||||
- 'scripts/windowsish-17.ps1'
|
||||
|
||||
pull_request:
|
||||
branches:
|
||||
@@ -22,47 +24,145 @@ jobs:
|
||||
matrix:
|
||||
image:
|
||||
- "ubuntu-latest"
|
||||
- "ubuntu-20.04"
|
||||
- "ubuntu-22.04"
|
||||
- "ubuntu-24.04"
|
||||
- "macos-latest"
|
||||
- "macos-11"
|
||||
- "macos-12"
|
||||
- "macos-13"
|
||||
- "macos-14"
|
||||
- "macos-15"
|
||||
- "windows-latest"
|
||||
- "windows-2022"
|
||||
- "windows-2019"
|
||||
- "windows-2022"
|
||||
force:
|
||||
- 'true'
|
||||
- 'false'
|
||||
name: "Test Action - (img: ${{ matrix.image }}; force: ${{ matrix.force }})"
|
||||
version:
|
||||
- '1.7'
|
||||
- '1.7.1'
|
||||
- '1.8.0'
|
||||
include:
|
||||
- image: "ubuntu-latest"
|
||||
version: '1.6'
|
||||
force: true
|
||||
- image: "ubuntu-latest"
|
||||
version: '1.6'
|
||||
force: false
|
||||
- image: "ubuntu-latest"
|
||||
version: '1.5'
|
||||
force: true
|
||||
- image: "ubuntu-latest"
|
||||
version: '1.5'
|
||||
force: false
|
||||
|
||||
- image: "ubuntu-22.04"
|
||||
version: '1.6'
|
||||
force: true
|
||||
- image: "ubuntu-22.04"
|
||||
version: '1.6'
|
||||
force: false
|
||||
- image: "ubuntu-22.04"
|
||||
version: '1.5'
|
||||
force: true
|
||||
- image: "ubuntu-22.04"
|
||||
version: '1.5'
|
||||
force: false
|
||||
|
||||
- image: "ubuntu-24.04"
|
||||
version: '1.6'
|
||||
force: true
|
||||
- image: "ubuntu-24.04"
|
||||
version: '1.6'
|
||||
force: false
|
||||
- image: "ubuntu-24.04"
|
||||
version: '1.5'
|
||||
force: true
|
||||
- image: "ubuntu-24.04"
|
||||
version: '1.5'
|
||||
force: false
|
||||
|
||||
- image: "windows-latest"
|
||||
version: '1.6'
|
||||
force: true
|
||||
- image: "windows-latest"
|
||||
version: '1.6'
|
||||
force: false
|
||||
- image: "windows-latest"
|
||||
version: '1.5'
|
||||
force: true
|
||||
- image: "windows-latest"
|
||||
version: '1.5'
|
||||
force: false
|
||||
|
||||
- image: "windows-2019"
|
||||
version: '1.6'
|
||||
force: true
|
||||
- image: "windows-2019"
|
||||
version: '1.6'
|
||||
force: false
|
||||
- image: "windows-2019"
|
||||
version: '1.5'
|
||||
force: true
|
||||
- image: "windows-2019"
|
||||
version: '1.5'
|
||||
force: false
|
||||
|
||||
- image: "windows-2022"
|
||||
version: '1.6'
|
||||
force: true
|
||||
- image: "windows-2022"
|
||||
version: '1.6'
|
||||
force: false
|
||||
- image: "windows-2022"
|
||||
version: '1.5'
|
||||
force: true
|
||||
- image: "windows-2022"
|
||||
version: '1.5'
|
||||
force: false
|
||||
|
||||
name: "Test Action - (img: ${{ matrix.image }}; version: ${{ matrix.version }}; force: ${{ matrix.force }})"
|
||||
runs-on: ${{ matrix.image }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3.1.0
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup jq
|
||||
id: install-jq
|
||||
uses: dcarbone/install-jq-action@main
|
||||
uses: ./
|
||||
with:
|
||||
version: '${{ matrix.version }}'
|
||||
force: '${{ matrix.force }}'
|
||||
|
||||
- name: Check jq - Unix-ish
|
||||
if: runner.os == 'Linux' || runner.os == 'macOS'
|
||||
if: (runner.os == 'Linux' || runner.os == 'macOS') && matrix.force == 'true'
|
||||
# language=sh
|
||||
run: |
|
||||
which jq
|
||||
jq --version
|
||||
_err=
|
||||
_which="$(which jq)"
|
||||
_vers="$(jq --version)"
|
||||
if [[ "${_which}" != "$RUNNER_TOOL_CACHE/jq/jq" ]]; then
|
||||
echo "jq found at unexpected path."
|
||||
echo " Expected: \"$RUNNER_TOOL_CACHE/jq/jq\""
|
||||
echo " Actual: \"${_which}\""
|
||||
_err=1
|
||||
fi
|
||||
if [[ "${_vers}" != 'jq-${{ matrix.version }}' ]]; then
|
||||
echo "jq --version returned unexpected value"
|
||||
echo ' Expected: "jq-${{ matrix.version }}"'
|
||||
echo " Actual: \"${_vers}\""
|
||||
_err=1
|
||||
fi
|
||||
if [ -n "${_err}" ]; then exit 1; fi;
|
||||
|
||||
- name: Check Outputs - Unix-ish
|
||||
if: runner.os == 'Linux' || runner.os == 'macOS'
|
||||
shell: bash -e {0}
|
||||
# language=sh
|
||||
run: |
|
||||
_installed='${{ steps.install-jq.outputs.installed }}'
|
||||
_err=
|
||||
if [[ '${{ matrix.force }}' == 'true' ]]; then
|
||||
# enabling "force" must result in an install
|
||||
if [[ '${{ steps.install-jq.outputs.installed }}' != 'true' ]]; then
|
||||
echo 'Unexpected value for "installed":'
|
||||
echo 'Expected: "true"'
|
||||
echo 'Actual: "${{ steps.install-jq.outputs.installed }}"'
|
||||
_err=1
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
if [[ '${{ steps.install-jq.outputs.found }}' == 'true' ]]; then
|
||||
@@ -71,7 +171,7 @@ jobs:
|
||||
echo 'Unexpected value for "installed":'
|
||||
echo 'Expected: "false"'
|
||||
echo 'Actual: "${{ steps.install-jq.outputs.installed }}"'
|
||||
_err=1
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# if not found, must be installed
|
||||
@@ -79,27 +179,34 @@ jobs:
|
||||
echo 'Unexpected value for "installed":'
|
||||
echo 'Expected: "true"'
|
||||
echo 'Actual: "${{ steps.install-jq.outputs.installed }}"'
|
||||
_err=1
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ -n "${_err}" ]; then exit 1; fi;
|
||||
|
||||
|
||||
- name: Check jq - Windows-ish
|
||||
if: runner.os == 'Windows'
|
||||
if: runner.os == 'Windows' && matrix.force == 'true'
|
||||
# language=powershell
|
||||
run: |
|
||||
Get-Command "jq.exe"
|
||||
jq.exe --version
|
||||
$_cmd={jq.exe --version }
|
||||
$_vers=jq.exe --version 2>&1
|
||||
if ( "${_vers}" -ne "jq-${{ matrix.version }}" -and "${_vers}" -ne "jq-${{ matrix.version }}-dirty" )
|
||||
{
|
||||
Write-Host "jq.exe --version returned unexpected value"
|
||||
Write-Host " Expected: jq-${{ matrix.version }}"
|
||||
Write-Host " Actual: ${_vers}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
- name: Check Outputs - Windows-ish
|
||||
if: runner.os == 'Windows'
|
||||
shell: powershell
|
||||
# language=powershell
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
Set-StrictMode -Version Latest
|
||||
$_installed='${{ steps.install-jq.outputs.installed }}'
|
||||
$_err = 0
|
||||
if ("${{ matrix.force }}" -eq "true")
|
||||
{
|
||||
# enabling "force" must result in an install
|
||||
@@ -108,7 +215,7 @@ jobs:
|
||||
Write-Host "Unexpected value for installed"
|
||||
Write-Host "Expected: true"
|
||||
Write-Host "Actual: ${{ steps.install-jq.outputs.installed }}"
|
||||
$_err=1
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -121,7 +228,7 @@ jobs:
|
||||
Write-Host "Unexpected value for installed"
|
||||
Write-Host "Expected: false"
|
||||
Write-Host "Actual: ${{ steps.install-jq.outputs.installed }}"
|
||||
$_err=1
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -131,11 +238,84 @@ jobs:
|
||||
Write-Host "Unexpected value for installed"
|
||||
Write-Host "Expected: true"
|
||||
Write-Host "Actual: ${{ steps.install-jq.outputs.installed }}"
|
||||
$_err=1
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
}
|
||||
if ("${_err}" -ne 0)
|
||||
{
|
||||
test-container:
|
||||
strategy:
|
||||
matrix:
|
||||
image:
|
||||
- "ubuntu-24.04"
|
||||
- "ubuntu-22.04"
|
||||
force:
|
||||
- 'true'
|
||||
- 'false'
|
||||
version:
|
||||
- '1.5'
|
||||
- '1.6'
|
||||
- '1.7'
|
||||
- '1.7.1'
|
||||
- '1.8.0'
|
||||
name: "Test Action (Container) - (img: ${{ matrix.image }}; version: ${{ matrix.version }}; force: ${{ matrix.force }})"
|
||||
runs-on: ${{ matrix.image }}
|
||||
container:
|
||||
image: node:20
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup jq
|
||||
id: install-jq
|
||||
uses: ./
|
||||
with:
|
||||
version: '${{ matrix.version }}'
|
||||
force: '${{ matrix.force }}'
|
||||
|
||||
- name: Check jq
|
||||
# language=sh
|
||||
run: |
|
||||
_which="$(which jq)"
|
||||
_vers="$(jq --version)"
|
||||
if [[ "${_which}" != "$RUNNER_TOOL_CACHE/jq/jq" ]]; then
|
||||
echo "jq found at unexpected path."
|
||||
echo " Expected: \"$RUNNER_TOOL_CACHE/jq/jq\""
|
||||
echo " Actual: \"${_which}\""
|
||||
exit 1
|
||||
fi
|
||||
if [[ "${_vers}" != 'jq-${{ matrix.version }}' ]]; then
|
||||
echo "jq --version returned unexpected value"
|
||||
echo ' Expected: "jq-${{ matrix.version }}"'
|
||||
echo " Actual: \"${_vers}\""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Check Outputs
|
||||
# language=sh
|
||||
run: |
|
||||
if [[ '${{ matrix.force }}' == 'true' ]]; then
|
||||
# enabling "force" must result in an install
|
||||
if [[ '${{ steps.install-jq.outputs.installed }}' != 'true' ]]; then
|
||||
echo 'Unexpected value for "installed":'
|
||||
echo 'Expected: "true"'
|
||||
echo 'Actual: "${{ steps.install-jq.outputs.installed }}"'
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
else
|
||||
if [[ '${{ steps.install-jq.outputs.found }}' == 'true' ]]; then
|
||||
# if found, must not be installed without force
|
||||
if [[ '${{ steps.install-jq.outputs.installed }}' != 'false' ]]; then
|
||||
echo 'Unexpected value for "installed":'
|
||||
echo 'Expected: "false"'
|
||||
echo 'Actual: "${{ steps.install-jq.outputs.installed }}"'
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# if not found, must be installed
|
||||
if [[ '${{ steps.install-jq.outputs.installed }}' != 'true' ]]; then
|
||||
echo 'Unexpected value for "installed":'
|
||||
echo 'Expected: "true"'
|
||||
echo 'Actual: "${{ steps.install-jq.outputs.installed }}"'
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
13
README.md
13
README.md
@@ -1,9 +1,15 @@
|
||||
# install-jq-action
|
||||
Multiplatform [jq](https://github.com/stedolan/jq) installer action
|
||||
|
||||
[](https://github.com/dcarbone/install-jq-action/actions/workflows/tests.yaml)
|
||||
[](https://github.com/dcarbone/install-jq-action/actions/workflows/tests.yaml)
|
||||
|
||||
This action cannot currently handle MacOS arm64 runners.
|
||||
This action is tested against the following versions of JQ:
|
||||
|
||||
- [1.8.0](https://github.com/jqlang/jq/releases/tag/jq-1.8.0)
|
||||
- [1.7.1](https://github.com/jqlang/jq/releases/tag/jq-1.7.1)
|
||||
- [1.7](https://github.com/jqlang/jq/releases/tag/jq-1.7)
|
||||
- [1.6](https://github.com/jqlang/jq/releases/tag/jq-1.6)
|
||||
- [1.5](https://github.com/jqlang/jq/releases/tag/jq-1.5)
|
||||
|
||||
# Index
|
||||
|
||||
@@ -16,6 +22,7 @@ This action cannot currently handle MacOS arm64 runners.
|
||||
|
||||
* [linux](./.github/workflows/example-linux.yaml)
|
||||
* [macos](./.github/workflows/example-macos.yaml)
|
||||
* [windows](./.github/workflows/example-windows.yaml)
|
||||
|
||||
## Action Inputs
|
||||
|
||||
@@ -24,7 +31,7 @@ This action cannot currently handle MacOS arm64 runners.
|
||||
version:
|
||||
required: false
|
||||
description: "Version of jq to install"
|
||||
default: "1.6"
|
||||
default: "1.7.1"
|
||||
```
|
||||
|
||||
This must be a version with a [corresponding release](https://github.com/stedolan/jq/releases).
|
||||
|
||||
38
action.yaml
38
action.yaml
@@ -9,8 +9,8 @@ branding:
|
||||
inputs:
|
||||
version:
|
||||
required: false
|
||||
description: "Version of jq to install"
|
||||
default: "1.6"
|
||||
description: "Version of jq to install."
|
||||
default: "1.7.1"
|
||||
force:
|
||||
required: false
|
||||
description: "If 'true', does not check for existing jq installation before continuing."
|
||||
@@ -30,7 +30,8 @@ runs:
|
||||
- name: 'Check for jq - Unix-ish'
|
||||
id: jq-check-unix
|
||||
if: (runner.os == 'Linux' || runner.os == 'macOS')
|
||||
shell: bash +e {0}
|
||||
shell: sh +e {0}
|
||||
# language=sh
|
||||
run: |
|
||||
_jq_bin="$(which jq)"
|
||||
if [ -f "${_jq_bin}" ]; then
|
||||
@@ -39,17 +40,27 @@ runs:
|
||||
echo "found=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: 'Install jq - Unix-ish'
|
||||
if: (runner.os == 'Linux' || runner.os == 'macOS') && (steps.jq-check-unix.outputs.found == 'false' || inputs.force == 'true')
|
||||
shell: bash
|
||||
- name: 'Install jq - Unix-ish sub-1.7'
|
||||
if: (runner.os == 'Linux' || runner.os == 'macOS') && (startsWith(inputs.version, '1.5') || startsWith(inputs.version, '1.6')) && (steps.jq-check-unix.outputs.found == 'false' || inputs.force == 'true')
|
||||
shell: sh
|
||||
env:
|
||||
JQ_VERSION: '${{ inputs.version }}'
|
||||
run: $GITHUB_ACTION_PATH/scripts/unixish.sh
|
||||
# language=sh
|
||||
run: ${GITHUB_ACTION_PATH}/scripts/unixish.sh
|
||||
|
||||
- name: 'Install jq - Unix-ish 1.7+'
|
||||
if: (runner.os == 'Linux' || runner.os == 'macOS') && (startsWith(inputs.version, '1.7') || startsWith(inputs.version, '1.8')) && (steps.jq-check-unix.outputs.found == 'false' || inputs.force == 'true')
|
||||
shell: sh
|
||||
env:
|
||||
JQ_VERSION: '${{ inputs.version }}'
|
||||
# language=sh
|
||||
run: ${GITHUB_ACTION_PATH}/scripts/unixish-17.sh
|
||||
|
||||
- name: 'Check for jq - Windows-ish'
|
||||
id: jq-check-windows
|
||||
if: runner.os == 'Windows'
|
||||
shell: powershell
|
||||
# language=powershell
|
||||
run: |
|
||||
if (Get-Command "jq.exe" -ErrorAction SilentlyContinue)
|
||||
{
|
||||
@@ -60,9 +71,16 @@ runs:
|
||||
Add-Content $Env:GITHUB_OUTPUT "found=false"
|
||||
}
|
||||
|
||||
- name: 'Install jq - Windows-ish'
|
||||
if: runner.os == 'Windows' && (steps.jq-check-windows.outputs.found == 'false' || inputs.force == 'true')
|
||||
- name: 'Install jq - Windows-ish sub-1.7'
|
||||
if: runner.os == 'Windows' && (startsWith(inputs.version, '1.5') || startsWith(inputs.version, '1.6')) && (steps.jq-check-windows.outputs.found == 'false' || inputs.force == 'true')
|
||||
shell: powershell
|
||||
env:
|
||||
JQ_VERSION: '${{ inputs.version }}'
|
||||
run: '& $Env:GITHUB_ACTION_PATH\scripts\windowsish.ps1'
|
||||
run: ${{ github.action_path }}\scripts\windowsish.ps1
|
||||
|
||||
- name: 'Install jq - Windows-ish 1.7+'
|
||||
if: runner.os == 'Windows' && (startsWith(inputs.version, '1.7') || startsWith(inputs.version, '1.8')) && (steps.jq-check-windows.outputs.found == 'false' || inputs.force == 'true')
|
||||
shell: powershell
|
||||
env:
|
||||
JQ_VERSION: '${{ inputs.version }}'
|
||||
run: ${{ github.action_path }}\scripts\windowsish-17.ps1
|
||||
|
||||
95
scripts/unixish-17.sh
Executable file
95
scripts/unixish-17.sh
Executable file
@@ -0,0 +1,95 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
echo '::group::Prep'
|
||||
|
||||
# validate input and prepare some vars
|
||||
|
||||
_base_url='https://github.com/jqlang/jq/releases/download'
|
||||
|
||||
_arch_env="$(echo "$RUNNER_ARCH" | tr '[:upper:]' '[:lower:]')"
|
||||
|
||||
_os=
|
||||
_arch=
|
||||
|
||||
_bin_name=
|
||||
_dl_name=
|
||||
_dl_path=
|
||||
_dl_url=
|
||||
|
||||
case $RUNNER_OS in
|
||||
[Ll]inux)
|
||||
_os='linux'
|
||||
;;
|
||||
mac[Oo][Ss])
|
||||
_os='macos'
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Cannot handle OS of type $RUNNER_OS"
|
||||
echo "Expected one of: [ Linux macOS ]"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
case "${_arch_env}" in
|
||||
'x86'|'386')
|
||||
_arch='i386'
|
||||
;;
|
||||
'x64'|'amd64'|'x86_64')
|
||||
_arch='amd64'
|
||||
;;
|
||||
'arm'|'armhf')
|
||||
_arch='armhf'
|
||||
;;
|
||||
'armel')
|
||||
_arch='armel'
|
||||
;;
|
||||
'arm64'|'aarch64')
|
||||
_arch='arm64'
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Cannot handle arch of type $RUNNER_ARCH"
|
||||
echo "Expected one of: [ x86 386 x64 amd64 x86_64 arm armhf armel arm64 aarch64 ]"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# build bin name
|
||||
_bin_name="jq-${_os}-${_arch}"
|
||||
|
||||
# build download vars
|
||||
_dl_name="${_bin_name}"
|
||||
_dl_path="$RUNNER_TEMP/${_dl_name}"
|
||||
|
||||
_dl_url="${_base_url}/jq-$JQ_VERSION/${_dl_name}"
|
||||
|
||||
echo '::endgroup::'
|
||||
|
||||
echo '::group::Downloading jq'
|
||||
|
||||
echo "Src: ${_dl_url}"
|
||||
echo "Dst: ${_dl_path}"
|
||||
|
||||
curl -L "${_dl_url}" -o "${_dl_path}"
|
||||
|
||||
echo '::endgroup::'
|
||||
|
||||
echo '::group::Copying to tool cache'
|
||||
|
||||
echo "Creating tool cache directory $RUNNER_TOOL_CACHE/jq"
|
||||
mkdir -p "$RUNNER_TOOL_CACHE/jq"
|
||||
|
||||
echo "Installing into tool cache:"
|
||||
echo "Src: $RUNNER_TEMP/${_bin_name}"
|
||||
echo "Dst: $RUNNER_TOOL_CACHE/jq/jq"
|
||||
mv "$RUNNER_TEMP/${_bin_name}" "$RUNNER_TOOL_CACHE/jq/jq"
|
||||
|
||||
chmod +x "$RUNNER_TOOL_CACHE/jq/jq"
|
||||
|
||||
echo "Adding $RUNNER_TOOL_CACHE/jq to path..."
|
||||
echo "$RUNNER_TOOL_CACHE/jq" >> $GITHUB_PATH
|
||||
|
||||
echo '::endgroup::'
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
@@ -17,10 +17,10 @@ _dl_path=
|
||||
_dl_url=
|
||||
|
||||
case $RUNNER_OS in
|
||||
Linux)
|
||||
[Ll]inux)
|
||||
_os='linux'
|
||||
;;
|
||||
macOS)
|
||||
mac[Oo][Ss])
|
||||
_os='osx'
|
||||
;;
|
||||
|
||||
@@ -54,7 +54,7 @@ esac
|
||||
|
||||
# determine binary name
|
||||
|
||||
if [[ "${_os}" == "linux" ]]; then
|
||||
if [ "${_os}" = "linux" ]; then
|
||||
case "${_arch}" in
|
||||
'386')
|
||||
_bin_name="jq-linux32"
|
||||
@@ -93,7 +93,7 @@ echo '::group::Downloading jq'
|
||||
echo "Src: ${_dl_url}"
|
||||
echo "Dst: ${_dl_path}"
|
||||
|
||||
wget -O- "${_dl_url}" > "${_dl_path}"
|
||||
curl -L "${_dl_url}" -o "${_dl_path}"
|
||||
|
||||
echo '::endgroup::'
|
||||
|
||||
@@ -107,6 +107,8 @@ echo "Src: $RUNNER_TEMP/${_bin_name}"
|
||||
echo "Dst: $RUNNER_TOOL_CACHE/jq/jq"
|
||||
mv "$RUNNER_TEMP/${_bin_name}" "$RUNNER_TOOL_CACHE/jq/jq"
|
||||
|
||||
chmod +x "$RUNNER_TOOL_CACHE/jq/jq"
|
||||
|
||||
echo "Adding $RUNNER_TOOL_CACHE/jq to path..."
|
||||
echo "$RUNNER_TOOL_CACHE/jq" >> $GITHUB_PATH
|
||||
|
||||
|
||||
74
scripts/windowsish-17.ps1
Executable file
74
scripts/windowsish-17.ps1
Executable file
@@ -0,0 +1,74 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
Set-StrictMode -Version Latest
|
||||
|
||||
Write-Host "::group::Prep"
|
||||
|
||||
$_base_url = "https://github.com/jqlang/jq/releases/download"
|
||||
|
||||
$_arch_env = ($Env:RUNNER_ARCH).ToLower()
|
||||
|
||||
# validate input and prepare some vars
|
||||
|
||||
switch ($_arch_env)
|
||||
{
|
||||
"x86" {
|
||||
$_arch = "i386"
|
||||
}
|
||||
"386" {
|
||||
$_arch = "i386"
|
||||
}
|
||||
"x64" {
|
||||
$_arch = "amd64"
|
||||
}
|
||||
"x86_64" {
|
||||
$_arch = "amd64"
|
||||
}
|
||||
"amd64" {
|
||||
$_arch = "amd64"
|
||||
}
|
||||
default {
|
||||
Write-Host "Cannot handle arch of type $Env:RUNNER_ARCH"
|
||||
Write-Host "Expected one of: [ x86 386 x64 x86_64 amd64 ]"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
# build bin name
|
||||
$_bin_name = "jq-windows-${_arch}.exe"
|
||||
|
||||
# build download vars
|
||||
|
||||
$_dl_name = "${_bin_name}"
|
||||
$_dl_path = "$Env:RUNNER_TEMP\${_dl_name}"
|
||||
|
||||
$_dl_url = "${_base_url}/jq-$Env:JQ_VERSION/${_dl_name}"
|
||||
|
||||
Write-Host "::endgroup::"
|
||||
|
||||
# download artifact
|
||||
|
||||
Write-Host "::group::Downloading jq"
|
||||
|
||||
Write-Host "Src: ${_dl_url}"
|
||||
Write-Host "Dst: ${_dl_path}"
|
||||
|
||||
Invoke-WebRequest -Uri "${_dl_url}" -OutFile "${_dl_path}"
|
||||
|
||||
Write-Host "::endgroup::"
|
||||
|
||||
# install into tool cache
|
||||
|
||||
Write-Host "::group::Copying to tool cache"
|
||||
|
||||
Write-Host "Creating tool cache directory $Env:RUNNER_TOOL_CACHE\jq\"
|
||||
New-Item "$Env:RUNNER_TOOL_CACHE\jq\" -ItemType Directory -Force
|
||||
|
||||
Write-Host "Installing into tool cache:"
|
||||
Write-Host "Src: $Env:RUNNER_TEMP\${_bin_name}"
|
||||
Write-Host "Dst: $Env:RUNNER_TOOL_CACHE\jq\jq.exe"
|
||||
Move-Item -Force -LiteralPath "$Env:RUNNER_TEMP\${_bin_name}" -Destination "$Env:RUNNER_TOOL_CACHE\jq\jq.exe"
|
||||
|
||||
Write-Host "Adding $Env:RUNNER_TOOL_CACHE\jq\ to path..."
|
||||
Add-Content "$Env:GITHUB_PATH" "$Env:RUNNER_TOOL_CACHE\jq\"
|
||||
|
||||
Write-Host "::endgroup::"
|
||||
0
scripts/windowsish.ps1
Normal file → Executable file
0
scripts/windowsish.ps1
Normal file → Executable file
Reference in New Issue
Block a user