4
4
push :
5
5
branches :
6
6
- main
7
- paths-ignore :
8
- - ' docs/**'
9
- - ' examples/**'
10
- - ' **.md'
11
7
tags :
12
8
- ' v[0-9]+.[0-9]+.[0-9]+'
13
9
pull_request :
14
10
branches :
15
11
- main
16
- types :
17
- - opened
18
- - reopened
19
- - synchronize
20
- paths-ignore :
21
- - ' docs/**'
22
- - ' examples/**'
23
- - ' **.md'
24
12
25
13
env :
26
14
platforms : " linux/amd64,linux/arm64,linux/ppc64le,linux/s390x"
@@ -32,46 +20,57 @@ concurrency:
32
20
jobs :
33
21
build :
34
22
name : Build Image
35
- runs-on : ubuntu-20.04
23
+ runs-on : ubuntu-22.04
24
+ permissions :
25
+ contents : read # for docker/build-push-action to read repo content
26
+ security-events : write # for github/codeql-action/upload-sarif to upload SARIF results
27
+ packages : write # for docker/build-push-action to push to GHCR
36
28
steps :
37
29
- name : Checkout Repository
38
- uses : actions/checkout@v3
39
- with :
40
- fetch-depth : 0
30
+ uses : actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
31
+
41
32
- name : DockerHub Login
42
- uses : docker/login-action@v2
33
+ uses : docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
43
34
with :
44
35
username : ${{ secrets.DOCKER_USERNAME }}
45
36
password : ${{ secrets.DOCKER_PASSWORD }}
46
37
if : github.event_name != 'pull_request'
38
+
47
39
- name : Login to GitHub Container Registry
48
- uses : docker/login-action@v2
40
+ uses : docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
49
41
with :
50
42
registry : ghcr.io
51
43
username : ${{ github.repository_owner }}
52
44
password : ${{ secrets.GITHUB_TOKEN }}
53
45
if : github.event_name != 'pull_request'
46
+
54
47
- name : Login to Quay.io
55
- uses : docker/login-action@v2
48
+ uses : docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
56
49
with :
57
50
registry : quay.io
58
51
username : ${{ secrets.QUAY_USERNAME }}
59
52
password : ${{ secrets.QUAY_ROBOT_TOKEN }}
60
53
if : github.event_name != 'pull_request'
54
+
61
55
- name : Setup QEMU
62
- uses : docker/setup-qemu-action@v2
56
+ uses : docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2.1.0
63
57
with :
64
58
platforms : arm64,ppc64le,s390x
65
59
if : github.event_name != 'pull_request'
60
+
66
61
- name : Docker Buildx
67
- uses : docker/setup-buildx-action@v2
62
+ uses : docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c # v2.5.0
63
+
68
64
- name : Output Variables
69
65
id : vars
70
66
run : |
71
67
echo "version=$(git describe --tags)" >> $GITHUB_OUTPUT
68
+ echo "chart_version=$(yq '.appVersion' <helm-charts/nginx-ingress/Chart.yaml)" >> $GITHUB_OUTPUT
69
+ echo "openshift_version=$(yq '.annotations["com.redhat.openshift.versions"]' <bundle/metadata/annotations.yaml | cut -dv -f2)" >> $GITHUB_OUTPUT
70
+
72
71
- name : Docker meta
73
72
id : meta
74
- uses : docker/metadata-action@v4
73
+ uses : docker/metadata-action@c4ee3adeed93b1fa6a762f209fb01608c1a22f1e # v4.4.0
75
74
with :
76
75
images : |
77
76
nginx/nginx-ingress-operator
91
90
release=1
92
91
summary="The NGINX Ingress Operator is a Kubernetes/OpenShift component which deploys and manages one or more NGINX/NGINX Plus Ingress Controllers"
93
92
description="The NGINX Ingress Operator is a Kubernetes/OpenShift component which deploys and manages one or more NGINX/NGINX Plus Ingress Controllers"
93
+
94
94
- name : Build Image
95
- uses : docker/build-push-action@v4
95
+ uses : docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4.0.0
96
96
with :
97
97
context : ' .'
98
98
cache-from : type=gha
@@ -104,23 +104,43 @@ jobs:
104
104
push : ${{ github.event_name != 'pull_request' }}
105
105
no-cache : ${{ github.event_name != 'pull_request' }}
106
106
pull : true
107
+ sbom : ${{ github.event_name != 'pull_request' }}
108
+ provenance : false
109
+
107
110
- name : Run Trivy vulnerability scanner
108
- uses :
aquasecurity/[email protected]
111
+ uses : aquasecurity/trivy-action@e5f43133f6e8736992c9f3c1b3296e24b37e17f2 # 0.10.0
109
112
continue-on-error : true
110
113
with :
111
114
image-ref : nginx/nginx-ingress-operator:${{ steps.meta.outputs.version }}
112
115
format : ' sarif'
113
116
output : ' trivy-results.sarif'
114
117
ignore-unfixed : ' true'
118
+
115
119
- name : Upload Trivy scan results to GitHub Security tab
116
- uses : github/codeql-action/upload-sarif@v2
120
+ uses : github/codeql-action/upload-sarif@f3feb00acb00f31a6f60280e6ace9ca31d91c76a # v2.3.2
117
121
continue-on-error : true
118
122
with :
119
123
sarif_file : ' trivy-results.sarif'
124
+
120
125
- name : Upload Scan Results
121
- uses : actions/upload-artifact@v3
126
+ uses : actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
122
127
continue-on-error : true
123
128
with :
124
129
name : ' trivy-results.sarif'
125
130
path : ' trivy-results.sarif'
126
131
if : always()
132
+
133
+ - name : Create/Update Draft
134
+ uses : lucacome/draft-release@b79be3ff634f771230b2b6ee9f47308c5793671a # v0.2.0
135
+ with :
136
+ minor-label : ' enhancement'
137
+ major-label : ' change'
138
+ variables : |
139
+ nic_version=${{ steps.vars.outputs.chart_version }}
140
+ openshift_version=${{ steps.vars.outputs.openshift_version }}
141
+ notes-footer : |
142
+ ## Compatibility
143
+
144
+ - NGINX Ingress Controller {{nic_version}}
145
+ - OpenShift {{openshift_version}} or newer.
146
+ if : github.event_name != 'pull_request'
0 commit comments