From 56c4a568023d1e573bf3d1e51a090500f89b4d54 Mon Sep 17 00:00:00 2001 From: appleboy Date: Sun, 24 Mar 2024 14:21:42 +0800 Subject: [PATCH] ci: update GitHub Actions configurations across workflows - Update the cron schedule in the CodeQL workflow file - Adjust the language array syntax in the CodeQL workflow file - Upgrade the CodeQL action version in the CodeQL workflow file - Modify the go version setup in the Go workflow file - Update the golangci-lint action version in the Go workflow file - Adjust the Go versions array in the Go workflow file - Upgrade the actions/cache version in the Go workflow file - Update the codecov-action version in the Go workflow file - Update the tags array syntax in the Goreleaser workflow file - Refactor the steps section in the Goreleaser workflow file - Modify the Go version setup in the Goreleaser workflow file - Update the GoReleaser action version in the Goreleaser workflow file Signed-off-by: appleboy --- .github/workflows/codeql.yml | 34 ++++++++++++++++---------------- .github/workflows/go.yml | 18 ++++++++++------- .github/workflows/goreleaser.yml | 17 ++++++++-------- 3 files changed, 36 insertions(+), 33 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 19f34b5..f3ceec8 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -13,12 +13,12 @@ name: "CodeQL" on: push: - branches: [ master ] + branches: [master] pull_request: # The branches below must be a subset of the branches above - branches: [ master ] + branches: [master] schedule: - - cron: '41 23 * * 6' + - cron: "41 23 * * 6" jobs: analyze: @@ -32,23 +32,23 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'go' ] + language: ["go"] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] # Learn more about CodeQL language support at https://git.io/codeql-language-support steps: - - name: Checkout repository - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v4 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index d7e429d..62bf91f 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -12,21 +12,25 @@ jobs: lint: runs-on: ubuntu-latest steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Setup go uses: actions/setup-go@v5 with: - go-version: '^1.16' - - name: Checkout repository - uses: actions/checkout@v4 + go-version-file: go.mod + check-latest: true - name: Setup golangci-lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v4 with: args: --verbose test: strategy: matrix: os: [ubuntu-latest] - go: [1.14, 1.15, 1.16, 1.17, 1.18, 1.19, '1.20'] + go: [1.18, 1.19, "1.20", 1.21, 1.22] include: - os: ubuntu-latest go-build: ~/.cache/go-build @@ -48,7 +52,7 @@ jobs: with: ref: ${{ github.ref }} - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: | ${{ matrix.go-build }} @@ -61,6 +65,6 @@ jobs: go test -v -covermode=atomic -coverprofile=coverage.out - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: flags: ${{ matrix.os }},go-${{ matrix.go }} diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index 1f2c744..0392c49 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -3,7 +3,7 @@ name: Goreleaser on: push: tags: - - '*' + - "*" permissions: contents: write @@ -12,23 +12,22 @@ jobs: goreleaser: runs-on: ubuntu-latest steps: - - - name: Checkout + - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0 - - - name: Set up Go + + - name: Setup go uses: actions/setup-go@v5 with: - go-version: 1.17 - - - name: Run GoReleaser + go-version-file: go.mod + check-latest: true + - name: Run GoReleaser uses: goreleaser/goreleaser-action@v5 with: # either 'goreleaser' (default) or 'goreleaser-pro' distribution: goreleaser version: latest - args: release --rm-dist + args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}