diff --git a/.github/actions/setup-goversion/action.yml b/.github/actions/setup-goversion/action.yml new file mode 100644 index 000000000..2570615af --- /dev/null +++ b/.github/actions/setup-goversion/action.yml @@ -0,0 +1,11 @@ +name: setup-goversion +runs: + using: composite + steps: + - id: goversion + run: | + cat Dockerfile | awk '/^FROM golang:.* as build$/ {v=$2;split(v,a,":")}; END {printf("version=%s", a[2])}' >> $GITHUB_OUTPUT + shell: bash + - uses: actions/setup-go@v5 + with: + go-version: "${{steps.goversion.outputs.version}}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d374c8eb1..863a658ec 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,9 +15,7 @@ jobs: - uses: actions/checkout@v4 with: fetch-tags: true - - uses: actions/setup-go@v5 - with: - go-version: '1.20' + - uses: ./.github/actions/setup-goversion - run: make cross - id: docker_tag run: echo "DOCKER_TAG=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cccee8942..24969d893 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,18 +13,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: '1.20' + - uses: ./.github/actions/setup-goversion - run: make lint test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: '1.20' + - uses: ./.github/actions/setup-goversion - uses: azure/setup-helm@v3 with: version: '3.13.1' @@ -36,7 +32,5 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: '1.20' + - uses: ./.github/actions/setup-goversion - run: make cross