From d86fb2b7858286eac1744c287c0d8b8b4c83763a Mon Sep 17 00:00:00 2001 From: Kuba Date: Tue, 19 Dec 2023 15:10:38 +0100 Subject: [PATCH] feat(BUX-420): CI/CD update for getting go version from go.mod --- .github/workflows/codeql-analysis.yml | 5 +++++ .github/workflows/go.yml | 14 ++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index bdbb1cdf..da5c890c 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -36,6 +36,11 @@ jobs: # a pull request then we can checkout the head. fetch-depth: 2 + - name: Install Go from go.mod + uses: actions/setup-go@v4 + with: + go-version-file: go.mod + # If this run was triggered by a pull request event, then checkout # the head of the pull request instead of the merge commit. - run: git checkout HEAD^2 diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index abd2076b..1bc1a345 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -14,12 +14,15 @@ jobs: golangci: strategy: matrix: - go-version: [1.19.x] os: [ubuntu-latest] name: lint runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 + - name: Install Go from go.mod + uses: actions/setup-go@v4 + with: + go-version-file: go.mod - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: @@ -28,16 +31,15 @@ jobs: build: strategy: matrix: - go-version: [ 1.19.x ] os: [ ubuntu-latest ] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - - name: Set up Go ${{ matrix.go-version }} + - name: Set up Go from go.mod uses: actions/setup-go@v4 with: - go-version: ${{ matrix.go-version }} + go-version-file: go.mod - name: Clean test cache run: go clean -testcache @@ -58,7 +60,7 @@ jobs: - run: git fetch --force --tags - uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version-file: go.mod - uses: goreleaser/goreleaser-action@v4 with: distribution: goreleaser @@ -100,7 +102,7 @@ jobs: - run: git fetch --force --tags - uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version-file: go.mod - name: Make directory for darwin bin run: | mkdir -p ./artifacts/darwin