mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-07-26 10:03:18 +00:00
* Fix UT failures caused by client-go version bump. * Some modifications to enhance the UT stability. * Fix UT errors: non-constant format string in call to ... * Fix linter issues. Signed-off-by: Xun Jiang <xun.jiang@broadcom.com>
34 lines
1.1 KiB
YAML
34 lines
1.1 KiB
YAML
on:
|
|
workflow_call:
|
|
inputs:
|
|
ref:
|
|
description: "The target branch's ref"
|
|
required: true
|
|
type: string
|
|
outputs:
|
|
version:
|
|
description: "The expected Go version"
|
|
value: ${{ jobs.extract.outputs.version }}
|
|
|
|
jobs:
|
|
extract:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
version: ${{ steps.pick-version.outputs.version }}
|
|
steps:
|
|
- name: Check out the code
|
|
uses: actions/checkout@v6
|
|
|
|
- id: pick-version
|
|
run: |
|
|
if [ "${{ inputs.ref }}" == "main" ]; then
|
|
version=$(grep '^go ' go.mod | awk '{print $2}' | cut -d. -f1-2)
|
|
else
|
|
goDirectiveVersion=$(grep '^go ' go.mod | awk '{print $2}')
|
|
toolChainVersion=$(grep '^toolchain ' go.mod | awk '{print $2}' | sed 's/^go//')
|
|
version=$(printf "%s\n%s\n" "$goDirectiveVersion" "$toolChainVersion" | sort -V | tail -n1)
|
|
fi
|
|
|
|
echo "version=$version"
|
|
echo "version=$version" >> $GITHUB_OUTPUT
|