-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (89 loc) · 2.31 KB
/
develop.yaml
File metadata and controls
106 lines (89 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: Develop
on:
push:
pull_request:
jobs:
build-and-test:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
cache-dependency-path: go.sum
- name: Build and test
run: make test
- name: Report test coverage
uses: ncruces/go-coverage-report@v0
with:
coverage-file: coverage.out
chart: true
amend: true
continue-on-error: true
if: |
github.event_name == 'push'
lint:
runs-on: ubuntu-latest
needs: build-and-test
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
cache-dependency-path: go.sum
- name: Lint Go code
run: make lint
scan:
runs-on: ubuntu-latest
needs: build-and-test
permissions:
contents: write # for sbom-action artifact uploads
actions: read # to find workflow artifacts when attaching release assets
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Generate SBOM
uses: anchore/sbom-action@v0.20.4
with:
path: .
format: spdx-json
output-file: sbom.spdx.json
- name: Scan SBOM with Grype
id: scan
uses: anchore/scan-action@v6
with:
sbom: sbom.spdx.json
fail-build: true
severity-cutoff: medium
output-format: table
release:
runs-on: ubuntu-latest
needs: scan
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
gh release create "$tag" \
--repo="$GITHUB_REPOSITORY" \
--title="$tag" \
--generate-notes