Skip to content

Commit

Permalink
ci: refine Go workflows and update actions versions
Browse files Browse the repository at this point in the history
- Add checkout step with `fetch-depth: 0` to `go.yml` workflow
- Specify `go-version-file` and enable `check-latest` in `go.yml` workflow
- Update GitHub Actions versions to v4 for checkout, cache, and codecov in `go.yml` workflow
- Rename and add setup steps for Go in `goreleaser.yml` workflow
- Change `goreleaser` arguments from `--rm-dist` to `--clean` in `goreleaser.yml` workflow

Signed-off-by: Bo-Yi Wu <[email protected]>
  • Loading branch information
appleboy committed Mar 10, 2024
1 parent a4e49c3 commit 466d7e9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
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"
- 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:
Expand Down Expand Up @@ -48,7 +52,7 @@ jobs:
with:
ref: ${{ github.ref }}

- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: |
${{ matrix.go-build }}
Expand All @@ -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 }}
10 changes: 7 additions & 3 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,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-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 466d7e9

Please sign in to comment.