Skip to content

Commit b05bfb1

Browse files
committed
ci: update GitHub actions and workflows for Go projects
- Change cron schedule format to use double quotes instead of single quotes - Update CodeQL action from v2 to v3 - Update Go setup action from v3 to v5 - Update checkout action from v3 to v4 - Update golangci-lint action from v3 to v6 - Expand Go versions tested to include 1.20, 1.21, 1.22, and 1.23 - Update cache action from v3 to v4 - Update Codecov action from v3 to v5 - Simplify GoReleaser workflow steps and update GoReleaser action from v4 to v5 - Modify GoReleaser arguments to use --clean instead of --rm-dist Signed-off-by: appleboy <[email protected]>
1 parent 74da028 commit b05bfb1

File tree

3 files changed

+27
-28
lines changed

3 files changed

+27
-28
lines changed

.github/workflows/codeql.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ name: "CodeQL"
77

88
on:
99
push:
10-
branches: [ main ]
10+
branches: [main]
1111
pull_request:
1212
# The branches below must be a subset of the branches above
13-
branches: [ main ]
13+
branches: [main]
1414
schedule:
15-
- cron: '30 1 * * 0'
15+
- cron: "30 1 * * 0"
1616

1717
jobs:
1818
analyze:
@@ -33,15 +33,15 @@ jobs:
3333
# Override automatic language detection by changing the below list
3434
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
3535
# TODO: Enable for javascript later
36-
language: [ 'go']
36+
language: ["go"]
3737

3838
steps:
3939
- name: Checkout repository
4040
uses: actions/checkout@v3
4141

4242
# Initializes the CodeQL tools for scanning.
4343
- name: Initialize CodeQL
44-
uses: github/codeql-action/init@v2
44+
uses: github/codeql-action/init@v3
4545
with:
4646
languages: ${{ matrix.language }}
4747
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -50,4 +50,4 @@ jobs:
5050
# queries: ./path/to/local/query, your-org/your-repo/queries@main
5151

5252
- name: Perform CodeQL Analysis
53-
uses: github/codeql-action/analyze@v2
53+
uses: github/codeql-action/analyze@v3

.github/workflows/go.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ jobs:
66
runs-on: ubuntu-latest
77
steps:
88
- name: Setup go
9-
uses: actions/setup-go@v3
9+
uses: actions/setup-go@v5
1010
with:
11-
go-version: '^1'
11+
go-version: "^1"
1212
- name: Checkout repository
13-
uses: actions/checkout@v3
13+
uses: actions/checkout@v4
14+
1415
- name: Setup golangci-lint
15-
uses: golangci/golangci-lint-action@v3
16+
uses: golangci/golangci-lint-action@v6
1617
with:
1718
version: latest
1819
args: --verbose
@@ -22,7 +23,7 @@ jobs:
2223
strategy:
2324
matrix:
2425
os: [ubuntu-latest]
25-
go: [1.17, 1.18, 1.19]
26+
go: [1.18, 1.19, "1.20", 1.21, 1.22, 1.23]
2627
include:
2728
- os: ubuntu-latest
2829
go-build: ~/.cache/go-build
@@ -47,11 +48,11 @@ jobs:
4748
go-version: ${{ matrix.go }}
4849

4950
- name: Checkout Code
50-
uses: actions/checkout@v3
51+
uses: actions/checkout@v4
5152
with:
5253
ref: ${{ github.ref }}
5354

54-
- uses: actions/cache@v3
55+
- uses: actions/cache@v4
5556
with:
5657
path: |
5758
${{ matrix.go-build }}
@@ -64,6 +65,6 @@ jobs:
6465
go test -v -covermode=atomic -coverprofile=coverage.out
6566
6667
- name: Upload coverage to Codecov
67-
uses: codecov/codecov-action@v3
68+
uses: codecov/codecov-action@v5
6869
with:
6970
flags: ${{ matrix.os }},go-${{ matrix.go }}

.github/workflows/goreleaser.yml

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Goreleaser
33
on:
44
push:
55
tags:
6-
- '*'
6+
- "*"
77

88
permissions:
99
contents: write
@@ -12,23 +12,21 @@ jobs:
1212
goreleaser:
1313
runs-on: ubuntu-latest
1414
steps:
15-
-
16-
name: Checkout
17-
uses: actions/checkout@v3
18-
with:
19-
fetch-depth: 0
20-
-
21-
name: Set up Go
22-
uses: actions/setup-go@v3
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Setup go
19+
uses: actions/setup-go@v5
2320
with:
24-
go-version: 1.17
25-
-
26-
name: Run GoReleaser
27-
uses: goreleaser/goreleaser-action@v4
21+
go-version-file: go.mod
22+
check-latest: true
23+
24+
- name: Run GoReleaser
25+
uses: goreleaser/goreleaser-action@v5
2826
with:
2927
# either 'goreleaser' (default) or 'goreleaser-pro'
3028
distribution: goreleaser
3129
version: latest
32-
args: release --rm-dist
30+
args: release --clean
3331
env:
3432
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)