Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

action: Clean up the logic to handle go-mod-directory #2956

Merged
merged 1 commit into from
Feb 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ inputs:
default: '*/cilium-cli'
go-mod-directory:
description: >
Override the directory that contains go.mod when building the Cilium CLI
Specify the directory that contains go.mod when building the Cilium CLI
from the source. By default, This action assumes that go.mod is in the
directory specified in the local-path parameter. Set this parameter to '.'
if go.mod is in the top-level directory.
top-level directory.
required: true
default: '.'
binary-dir:
description: 'Directory to store Cilium CLI executable'
required: true
Expand Down Expand Up @@ -46,22 +47,15 @@ runs:
run: |
CLI_PATH=$(find . -iwholename '${{ inputs.local-path }}' -type d -not -path './.git/*' -not -path './vendor/*' | sort | tail -n 1)
echo path="${CLI_PATH}" >> $GITHUB_OUTPUT
if [[ -z "${{ inputs.go-mod-directory }}" ]]; then
echo go-mod-path="${CLI_PATH}/go.mod" >> $GITHUB_OUTPUT
echo go-sum-path="${CLI_PATH}/go.sum" >> $GITHUB_OUTPUT
else
echo go-mod-path="${{ inputs.go-mod-directory }}/go.mod" >> $GITHUB_OUTPUT
echo go-sum-path="${{ inputs.go-mod-directory }}/go.sum" >> $GITHUB_OUTPUT
fi
echo go-mod-path="${{ inputs.go-mod-directory }}/go.mod" >> $GITHUB_OUTPUT

- name: Setup Go
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
if: ${{ steps.build-cli.outputs.path != '' }}
with:
# renovate: datasource=golang-version depName=go
go-version: 1.24.0
go-version-file: '${{ steps.build-cli.outputs.go-mod-path }}'
cache: true
cache-dependency-path: '${{ steps.build-cli.outputs.go-sum-path }}'
cache-dependency-path: '**/go.sum'

- name: Build Cilium CLI from source
if: ${{ steps.build-cli.outputs.path != '' }}
Expand Down
Loading