Install yq directly from GitHub release

This commit is contained in:
Michael B. Gale
2026-01-24 14:09:33 +00:00
parent efea9cca02
commit 605d404db0
2 changed files with 10 additions and 22 deletions

View File

@@ -76,18 +76,13 @@ jobs:
with:
java-version: ${{ inputs.java-version || '17' }}
distribution: temurin
- name: Restore choco cache
if: runner.os == 'Windows'
uses: actions/cache@v5
with:
key: windows-choco-cache
path: ${{ runner.temp }}/windows-choco-cache
- name: Install yq
if: runner.os == 'Windows'
shell: pwsh
env:
CACHE_DIR: ${{ runner.temp }}/windows-choco-cache
run: choco install yq -y --stoponfirstfailure --cache-location=${env:CACHE_DIR}
YQ_PATH: ${{ runner.temp }}/yq
run: |-
gh release download --repo mikefarah/yq --pattern "yq_windows_amd64.exe" v4.50.1 -O "$YQ_PATH/yq.exe"
echo "$YQ_PATH" >> "$GITHUB_PATH"
- name: Set up Java test repo configuration
run: |
mv * .github ../action/tests/multi-language-repo/

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env python
import ruamel.yaml
from ruamel.yaml.scalarstring import SingleQuotedScalarString
from ruamel.yaml.scalarstring import SingleQuotedScalarString, LiteralScalarString
import pathlib
import os
@@ -226,23 +226,16 @@ for file in sorted((this_dir / 'checks').glob('*.yml')):
installYq = is_truthy(checkSpecification.get('installYq', ''))
if installYq:
steps.append({
'name': "Restore choco cache",
'if': "runner.os == 'Windows'",
'uses': 'actions/cache@v5',
'with': {
'key': 'windows-choco-cache',
'path': '${{ runner.temp }}/windows-choco-cache'
}
})
steps.append({
'name': 'Install yq',
'if': "runner.os == 'Windows'",
'shell': 'pwsh',
'env': {
'CACHE_DIR': '${{ runner.temp }}/windows-choco-cache'
'YQ_PATH': '${{ runner.temp }}/yq'
},
'run': 'choco install yq -y --stoponfirstfailure --cache-location=${env:CACHE_DIR}',
'run': LiteralScalarString(
'gh release download --repo mikefarah/yq --pattern "yq_windows_amd64.exe" v4.50.1 -O "$YQ_PATH/yq.exe"\n'
'echo "$YQ_PATH" >> "$GITHUB_PATH"'
),
})
# If container initialisation steps are present in the check specification,