6
6
- main
7
7
- release-*
8
8
tags :
9
- - ' v[0-9]+.[0-9]+.[0-9]+*'
9
+ - " v[0-9]+.[0-9]+.[0-9]+*"
10
10
pull_request :
11
11
branches :
12
12
- main
28
28
platforms : " linux/arm64, linux/amd64"
29
29
30
30
jobs :
31
-
32
31
vars :
33
32
name : Checks and variables
34
33
runs-on : ubuntu-20.04
@@ -45,12 +44,10 @@ jobs:
45
44
46
45
- name : Output Variables
47
46
id : vars
48
- run : |
49
- echo "go_path=$(go env GOPATH)" >> $GITHUB_OUTPUT
47
+ run : echo "go_path=$(go env GOPATH)" >> $GITHUB_OUTPUT
50
48
51
49
- name : Check if go.mod and go.sum are up to date
52
- run : |
53
- go mod tidy && git diff --exit-code -- go.mod go.sum
50
+ run : go mod tidy && git diff --exit-code -- go.mod go.sum
54
51
55
52
unit-tests :
56
53
name : Unit Tests
88
85
node-version : 18
89
86
- run : npm --prefix ${{ github.workspace }}/internal/nginx/modules install-ci-test
90
87
88
+ release :
89
+ name : Release
90
+ runs-on : ubuntu-20.04
91
+ needs : [unit-tests, njs-unit-tests]
92
+ if : ${{ github.event_name == 'push' && github.ref != 'refs/heads/main' }}
93
+ steps :
94
+ - name : Checkout Repository
95
+ uses : actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
96
+
97
+ - name : Create/Update Draft
98
+ uses : lucacome/draft-release@b79be3ff634f771230b2b6ee9f47308c5793671a # v0.2.0
99
+ with :
100
+ minor-label : " enhancement"
101
+ major-label : " change"
102
+ publish : ${{ startsWith(github.ref, 'refs/tags/') }}
103
+ collapse-after : 20
104
+ notes-header : |
105
+ *Below is the auto-generated changelog, which includes all PRs that went into the release.
106
+ For a shorter version that highlights only important changes, see [CHANGELOG.md](https://github.com/nginxinc/nginx-kubernetes-gateway/blob/{{version}}/CHANGELOG.md).*
107
+
91
108
binary :
92
109
name : Build Binary
93
110
runs-on : ubuntu-20.04
@@ -103,32 +120,6 @@ jobs:
103
120
with :
104
121
go-version-file : go.mod
105
122
106
- - name : Publish release on tag
107
- uses : actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
108
- continue-on-error : true
109
- with :
110
- github-token : ${{secrets.GITHUB_TOKEN}}
111
- script : |
112
- const ref = context.ref.split("/")[2]
113
-
114
- const releases = (await github.rest.repos.listReleases({
115
- owner: context.payload.repository.owner.login,
116
- repo: context.payload.repository.name,
117
- per_page: 100,
118
- })).data
119
-
120
- const draft_release = releases.find(release => release.draft && release.tag_name === ref)
121
-
122
- const update = await github.rest.repos.updateRelease({
123
- owner: context.payload.repository.owner.login,
124
- repo: context.payload.repository.name,
125
- release_id: draft_release.id,
126
- draft: false
127
- });
128
- console.log(`Release published: ${update.data.html_url}`)
129
- console.log(`Release notes: ${update.data.body}`)
130
- if : startsWith(github.ref, 'refs/tags/')
131
-
132
123
- name : Download Syft
133
124
uses : anchore/sbom-action/download-syft@4d571ad1038a9cc29d676154ef265ab8f9027042 # v0.14.2
134
125
if : startsWith(github.ref, 'refs/tags/')
@@ -158,24 +149,29 @@ jobs:
158
149
steps :
159
150
- name : Checkout Repository
160
151
uses : actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
152
+
161
153
- name : Fetch Cached Artifacts
162
154
uses : actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
163
155
with :
164
156
path : ${{ github.workspace }}/dist
165
157
key : nginx-kubernetes-gateway-${{ github.run_id }}-${{ github.run_number }}
158
+
166
159
- name : Docker Buildx
167
160
uses : docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c # v2.5.0
161
+
168
162
- name : Setup QEMU
169
163
uses : docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2.1.0
170
164
with :
171
165
platforms : arm64
166
+
172
167
- name : Login to GitHub Container Registry
173
168
uses : docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
174
169
if : ${{ github.event_name != 'pull_request' }}
175
170
with :
176
171
registry : ghcr.io
177
172
username : ${{ github.repository_owner }}
178
173
password : ${{ secrets.GITHUB_TOKEN }}
174
+
179
175
- name : Docker meta
180
176
id : meta
181
177
uses : docker/metadata-action@c4ee3adeed93b1fa6a762f209fb01608c1a22f1e # v4.4.0
@@ -192,7 +188,7 @@ jobs:
192
188
uses : docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4.0.0
193
189
with :
194
190
file : build/Dockerfile
195
- context : ' . '
191
+ context : " . "
196
192
target : goreleaser
197
193
tags : ${{ steps.meta.outputs.tags }}
198
194
labels : ${{ steps.meta.outputs.labels }}
@@ -209,18 +205,20 @@ jobs:
209
205
continue-on-error : true
210
206
with :
211
207
image-ref : ghcr.io/nginxinc/nginx-kubernetes-gateway:${{ steps.meta.outputs.version }}
212
- format : ' sarif'
213
- output : ' trivy-results-nginx-kubernetes-gateway.sarif'
214
- ignore-unfixed : ' true'
208
+ format : " sarif"
209
+ output : " trivy-results-nginx-kubernetes-gateway.sarif"
210
+ ignore-unfixed : " true"
211
+
215
212
- name : Upload Trivy scan results to GitHub Security tab
216
213
uses : github/codeql-action/upload-sarif@0225834cc549ee0ca93cb085b92954821a145866 # v2.3.5
217
214
continue-on-error : true
218
215
with :
219
- sarif_file : ' trivy-results-nginx-kubernetes-gateway.sarif'
216
+ sarif_file : " trivy-results-nginx-kubernetes-gateway.sarif"
217
+
220
218
- name : Upload Scan Results
221
219
uses : actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
222
220
continue-on-error : true
223
221
with :
224
- name : ' trivy-results-nginx-kubernetes-gateway.sarif'
225
- path : ' trivy-results-nginx-kubernetes-gateway.sarif'
222
+ name : " trivy-results-nginx-kubernetes-gateway.sarif"
223
+ path : " trivy-results-nginx-kubernetes-gateway.sarif"
226
224
if : always()
0 commit comments