From 43fad6456b65d6dcbd4d69fdb6212f05fa9c02a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nemanja=20Zbilji=C4=87?= Date: Mon, 6 Jan 2025 18:03:07 +0100 Subject: [PATCH] ci: set environment variables dynamically --- .github/workflows/golangci-lint.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index d73f550..4951d1b 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -12,10 +12,6 @@ permissions: contents: read pull-requests: read -env: - GO_VERSION: 1.19.5 - GOLANGCI_LINT_VERSION: 1.50.1 - jobs: golangci: name: lint @@ -24,6 +20,11 @@ jobs: - uses: actions/checkout@v4 with: persist-credentials: false + - name: Set Github ENV variables + shell: bash + run: | + echo "GO_VERSION=$(cat go.mod | sed -En 's/go ([0-9.]+)/\1/p' | tr -d '[:blank:]')" >> $GITHUB_ENV + echo "GOLANGCI_LINT_VERSION=$(cat Makefile | sed -En 's/GOLANGCI_LINT_VERSION.+v(.*)/\1/p')" >> $GITHUB_ENV - uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }}