Skip to content

Commit b476794

Browse files
committed
ci: refactor GitHub Actions workflows configurations
- Update the cron schedule in the CodeQL workflow - Change the language specification in the CodeQL workflow - Upgrade the CodeQL action version in the CodeQL workflow - Modify the go version setup in the Go workflow - Update the golangci-lint action version in the Go workflow - Adjust the go version range in the Go workflow - Update the actions/cache version in the Go workflow - Upgrade the codecov-action version in the Go workflow - Change the tags specification in the Goreleaser workflow - Refactor the steps in the Goreleaser workflow - Adjust the Go version setup in the Goreleaser workflow - Modify the GoReleaser action setup in the Goreleaser workflow Signed-off-by: appleboy <[email protected]>
1 parent ef7d482 commit b476794

File tree

3 files changed

+36
-33
lines changed

3 files changed

+36
-33
lines changed

.github/workflows/codeql.yml

+17-17
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ name: "CodeQL"
1313

1414
on:
1515
push:
16-
branches: [ master ]
16+
branches: [master]
1717
pull_request:
1818
# The branches below must be a subset of the branches above
19-
branches: [ master ]
19+
branches: [master]
2020
schedule:
21-
- cron: '41 23 * * 6'
21+
- cron: "41 23 * * 6"
2222

2323
jobs:
2424
analyze:
@@ -32,23 +32,23 @@ jobs:
3232
strategy:
3333
fail-fast: false
3434
matrix:
35-
language: [ 'go' ]
35+
language: ["go"]
3636
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
3737
# Learn more about CodeQL language support at https://git.io/codeql-language-support
3838

3939
steps:
40-
- name: Checkout repository
41-
uses: actions/checkout@v4
40+
- name: Checkout repository
41+
uses: actions/checkout@v4
4242

43-
# Initializes the CodeQL tools for scanning.
44-
- name: Initialize CodeQL
45-
uses: github/codeql-action/init@v3
46-
with:
47-
languages: ${{ matrix.language }}
48-
# If you wish to specify custom queries, you can do so here or in a config file.
49-
# By default, queries listed here will override any specified in a config file.
50-
# Prefix the list here with "+" to use these queries and those in the config file.
51-
# queries: ./path/to/local/query, your-org/your-repo/queries@main
43+
# Initializes the CodeQL tools for scanning.
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@v3
46+
with:
47+
languages: ${{ matrix.language }}
48+
# If you wish to specify custom queries, you can do so here or in a config file.
49+
# By default, queries listed here will override any specified in a config file.
50+
# Prefix the list here with "+" to use these queries and those in the config file.
51+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
5252

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

.github/workflows/go.yml

+11-7
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,25 @@ jobs:
1212
lint:
1313
runs-on: ubuntu-latest
1414
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
1520
- name: Setup go
1621
uses: actions/setup-go@v5
1722
with:
18-
go-version: '^1'
19-
- name: Checkout repository
20-
uses: actions/checkout@v4
23+
go-version-file: go.mod
24+
check-latest: true
2125
- name: Setup golangci-lint
22-
uses: golangci/golangci-lint-action@v3
26+
uses: golangci/golangci-lint-action@v4
2327
with:
2428
args: --verbose
2529
test:
2630
strategy:
2731
matrix:
2832
os: [ubuntu-latest]
29-
go: [1.18, 1.19, '1.20', 1.21, 1.22]
33+
go: [1.18, 1.19, "1.20", 1.21, 1.22]
3034
include:
3135
- os: ubuntu-latest
3236
go-build: ~/.cache/go-build
@@ -48,7 +52,7 @@ jobs:
4852
with:
4953
ref: ${{ github.ref }}
5054

51-
- uses: actions/cache@v3
55+
- uses: actions/cache@v4
5256
with:
5357
path: |
5458
${{ matrix.go-build }}
@@ -61,6 +65,6 @@ jobs:
6165
go test -v -covermode=atomic -coverprofile=coverage.out
6266
6367
- name: Upload coverage to Codecov
64-
uses: codecov/codecov-action@v3
68+
uses: codecov/codecov-action@v4
6569
with:
6670
flags: ${{ matrix.os }},go-${{ matrix.go }}

.github/workflows/goreleaser.yml

+8-9
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,22 @@ jobs:
1212
goreleaser:
1313
runs-on: ubuntu-latest
1414
steps:
15-
-
16-
name: Checkout
15+
- name: Checkout repository
1716
uses: actions/checkout@v4
1817
with:
1918
fetch-depth: 0
20-
-
21-
name: Set up Go
19+
20+
- name: Setup go
2221
uses: actions/setup-go@v5
2322
with:
24-
go-version: 1.17
25-
-
26-
name: Run GoReleaser
23+
go-version-file: go.mod
24+
check-latest: true
25+
- name: Run GoReleaser
2726
uses: goreleaser/goreleaser-action@v5
2827
with:
2928
# either 'goreleaser' (default) or 'goreleaser-pro'
3029
distribution: goreleaser
3130
version: latest
32-
args: release --rm-dist
31+
args: release --clean
3332
env:
3433
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)