From 69943dce32bd703a8f2cc7ac97f6c43f568546ec Mon Sep 17 00:00:00 2001 From: Wanis Fahmy <51237742+wanisfahmyDE@users.noreply.github.com> Date: Thu, 25 Apr 2024 11:14:18 +0200 Subject: [PATCH] ci: updates goreleaser and retrieves go from mod file --- .github/workflows/build-and-test.yaml | 6 +++++- .github/workflows/codeql-analysis.yaml | 4 ++++ .github/workflows/goreleaser.yaml | 8 ++++++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index 096f8c8..293bee2 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -18,10 +18,12 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Set up Go uses: actions/setup-go@v5 with: - go-version: 1.21 + go-version-file: go.mod + - name: Cache Go modules uses: actions/cache@v4 with: @@ -29,10 +31,12 @@ jobs: key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go- + - name: Go vet run: | go vet ./... go vet github.com/theurichde/go-aws-sso/internal + - name: Tests run: | go clean -r -testcache diff --git a/.github/workflows/codeql-analysis.yaml b/.github/workflows/codeql-analysis.yaml index d98983f..0afcd29 100644 --- a/.github/workflows/codeql-analysis.yaml +++ b/.github/workflows/codeql-analysis.yaml @@ -14,6 +14,7 @@ jobs: analyze: name: Analyze runs-on: ubuntu-latest + permissions: actions: read contents: read @@ -27,11 +28,14 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + - name: Initialize CodeQL uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} + - name: Autobuild uses: github/codeql-action/autobuild@v3 + - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/goreleaser.yaml b/.github/workflows/goreleaser.yaml index 38419fa..d276bbc 100644 --- a/.github/workflows/goreleaser.yaml +++ b/.github/workflows/goreleaser.yaml @@ -13,10 +13,12 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Set up Go uses: actions/setup-go@v5 with: - go-version: 1.21 + go-version-file: go.mod + - name: Cache Go modules uses: actions/cache@v4 with: @@ -24,15 +26,17 @@ jobs: key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go- + - name: Tests run: | go test -v ./... go test -v github.com/theurichde/go-aws-sso/internal + - name: Run GoReleaser uses: goreleaser/goreleaser-action@v5 if: success() && startsWith(github.ref, 'refs/tags/') with: version: latest - args: release -f .goreleaser.yml --rm-dist + args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}