Skip to content

Commit

Permalink
ci: update GitHub Actions workflows for Go projects
Browse files Browse the repository at this point in the history
- Update CodeQL action to version 3 in `.github/workflows/codeql.yml`
- Update `actions/checkout` to version 4 and add `fetch-depth: 0` in `.github/workflows/go.yml`
- Update `golangci/golangci-lint-action` to version 4 in `.github/workflows/go.yml`
- Update `actions/cache` to version 4 in `.github/workflows/go.yml`
- Update `codecov/codecov-action` to version 4 in `.github/workflows/go.yml`
- Change the name of the step from "Checkout" to "Checkout repository" in `.github/workflows/goreleaser.yml`
- Update `actions/setup-go` to version 5 and add `go-version-file: go.mod` and `check-latest: true` in `.github/workflows/goreleaser.yml`
- Change the `args` from `release --rm-dist` to `release --clean` in `.github/workflows/goreleaser.yml`

Signed-off-by: appleboy <[email protected]>
  • Loading branch information
appleboy committed Mar 24, 2024
1 parent f12acd5 commit 4f4cf4e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ jobs:
# queries: ./path/to/local/query, your-org/your-repo/queries@main

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
16 changes: 10 additions & 6 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,18 @@ 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.21"
- 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:
version: latest
args: --verbose
Expand Down Expand Up @@ -49,7 +53,7 @@ jobs:
with:
ref: ${{ github.ref }}

- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: |
${{ matrix.go-build }}
Expand All @@ -62,6 +66,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 }}
10 changes: 6 additions & 4 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +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.21"
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 }}

0 comments on commit 4f4cf4e

Please sign in to comment.