Skip to content

Commit 5a6d788

Browse files
committed
chore: Update CI/CD workflows
1 parent 2e20699 commit 5a6d788

File tree

2 files changed

+25
-41
lines changed

2 files changed

+25
-41
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: ci
22
on:
33
push:
44
branches:
5-
- '*'
5+
- "*"
66
pull_request:
77
branches:
88
- master
@@ -13,30 +13,30 @@ jobs:
1313
name: scan for vulnerabilities
1414
runs-on: ubuntu-latest
1515
steps:
16-
# Go
17-
- name: Set up Go
18-
uses: actions/setup-go@v4
19-
with:
20-
go-version: 1.20.x
21-
2216
# Checkout code
2317
- name: Checkout repository
2418
uses: actions/checkout@v3
25-
19+
2620
# Configure runner environment
2721
- name: Set up runner environment
2822
run: ./.github/workflows/assets/utils.sh setup
2923
env:
3024
GITHUB_USER: ${{ github.actor }}
3125
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
32-
26+
3327
# Get commit message
3428
- name: Get commit message
3529
run: |
3630
echo 'commit_msg<<EOF' >> $GITHUB_ENV
3731
git log --format=%B -n 1 ${{ github.sha }} >> $GITHUB_ENV
3832
echo 'EOF' >> $GITHUB_ENV
3933
34+
# Go
35+
- name: Set up Go
36+
uses: actions/setup-go@v4
37+
with:
38+
go-version: 1.20.x
39+
4040
# List direct dependencies
4141
- name: List dependencies
4242
run: go list -mod=readonly -f '{{if not .Indirect}}{{.}}{{end}}' -m all > go.list
@@ -54,46 +54,34 @@ jobs:
5454
needs: scan
5555
strategy:
5656
matrix:
57-
go-version: [1.18.x, 1.19.x, 1.20.x]
57+
go-version: [1.19.x, 1.20.x]
5858
os: [ubuntu-latest]
5959
runs-on: ${{ matrix.os }}
6060
timeout-minutes: 15
6161
steps:
62-
# Go
63-
- name: Set up Go
64-
uses: actions/setup-go@v4
65-
with:
66-
go-version: ${{ matrix.go-version }}
67-
6862
# Checkout code
6963
- name: Checkout repository
7064
uses: actions/checkout@v3
71-
65+
7266
# Configure runner environment
7367
- name: Set up runner environment
7468
run: ./.github/workflows/assets/utils.sh setup
7569
env:
7670
GITHUB_USER: ${{ github.actor }}
7771
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
78-
72+
7973
# Get commit message
8074
- name: Get commit message
8175
run: |
8276
echo 'commit_msg<<EOF' >> $GITHUB_ENV
8377
git log --format=%B -n 1 ${{ github.sha }} >> $GITHUB_ENV
8478
echo 'EOF' >> $GITHUB_ENV
8579
86-
# If "vendor" is in cache, restore.
87-
# To run conditional steps use:
88-
# if: steps.vendor-cache.outputs.cache-hit != 'true'
89-
- name: Restore modules from cache
90-
id: vendor-cache
91-
uses: actions/cache@v3
92-
env:
93-
cache-name: vendor
80+
# Go
81+
- name: Set up Go
82+
uses: actions/setup-go@v4
9483
with:
95-
path: ./vendor
96-
key: ${{ env.cache-name }}-${{ hashFiles('go.sum') }}
84+
go-version: ${{ matrix.go-version }}
9785

9886
# Style consistency and static analysis using 'golangci-lint'
9987
# https://github.com/marketplace/actions/run-golangci-lint
@@ -117,7 +105,3 @@ jobs:
117105
name: assets
118106
path: |
119107
coverage.html
120-
121-
# Populate vendor cache to speed up future runs
122-
- name: Populate vendor cache
123-
run: go mod vendor

.github/workflows/release.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: release
22
on:
33
push:
44
tags:
5-
- '*'
5+
- "*"
66
jobs:
77
# Publish project package(s)
88
publish:
@@ -11,33 +11,33 @@ jobs:
1111
timeout-minutes: 10
1212
if: startsWith(github.ref, 'refs/tags/')
1313
steps:
14-
# Go
15-
- name: Set up Go
16-
uses: actions/setup-go@v4
17-
with:
18-
go-version: 1.20.x
19-
2014
# Checkout code
2115
- name: Checkout repository
2216
uses: actions/checkout@v3
2317
# This is required for the changelog to be properly generated
2418
with:
2519
fetch-depth: 0
26-
20+
2721
# Configure runner environment
2822
- name: Set up runner environment
2923
run: ./.github/workflows/assets/utils.sh setup
3024
env:
3125
GITHUB_USER: ${{ github.actor }}
3226
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
33-
27+
3428
# Get commit message
3529
- name: Get commit message
3630
run: |
3731
echo 'commit_msg<<EOF' >> $GITHUB_ENV
3832
git log --format=%B -n 1 ${{ github.sha }} >> $GITHUB_ENV
3933
echo 'EOF' >> $GITHUB_ENV
4034
35+
# Go
36+
- name: Set up Go
37+
uses: actions/setup-go@v4
38+
with:
39+
go-version: 1.20.x
40+
4141
# If "vendor" is in cache, restore.
4242
# To run conditional steps use:
4343
# if: steps.vendor-cache.outputs.cache-hit != 'true'

0 commit comments

Comments
 (0)