1212 tag :
1313 required : false
1414 type : string
15- sha_long :
16- required : false
17- type : string
1815
1916defaults :
2017 run :
@@ -23,12 +20,17 @@ defaults:
2320jobs :
2421 build :
2522 runs-on : ubuntu-22.04
23+ permissions :
24+ contents : read # for docker/build-push-action to read repo content
25+ security-events : write # for github/codeql-action/upload-sarif to upload SARIF results
26+ id-token : write # for OIDC login to AWS ECR
27+ packages : write # for docker/build-push-action to push to GHCR
2628 outputs :
2729 version : ${{ steps.meta.outputs.version }}
2830 image_digest : ${{ steps.build-push.outputs.digest }}
2931 steps :
3032 - name : Checkout Repository
31- uses : actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
33+ uses : actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
3234 with :
3335 ref : ${{ inputs.tag != '' && format('refs/tags/v{0}', inputs.tag) || github.ref }}
3436 fetch-depth : 0
@@ -63,12 +65,17 @@ jobs:
6365 password : ${{ secrets.GITHUB_TOKEN }}
6466 if : github.event_name != 'pull_request'
6567
68+ - name : Configure AWS Credentials
69+ uses : aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef # v2.0.0
70+ with :
71+ aws-region : us-east-1
72+ role-to-assume : ${{ secrets.AWS_ROLE_PUBLIC_ECR }}
73+ if : github.event_name != 'pull_request'
74+
6675 - name : Login to Public ECR
6776 uses : docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
6877 with :
6978 registry : public.ecr.aws
70- username : ${{ secrets.AWS_ACCESS_KEY_ID }}
71- password : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
7279 if : github.event_name != 'pull_request'
7380
7481 - name : Login to Quay.io
8996
9097 - name : Docker meta
9198 id : meta
92- uses : docker/metadata-action@507c2f2dc502c992ad446e3d7a5dfbe311567a96 # v4.3 .0
99+ uses : docker/metadata-action@c4ee3adeed93b1fa6a762f209fb01608c1a22f1e # v4.4 .0
93100 with :
101+ context : ${{ inputs.tag != '' && 'git' || 'workflow' }}
94102 images : |
95103 name=nginx/nginx-ingress
96104 name=ghcr.io/nginxinc/kubernetes-ingress
@@ -111,7 +119,6 @@ jobs:
111119 org.opencontainers.image.description=NGINX Ingress Controller for Kubernetes
112120 org.opencontainers.image.documentation=https://docs.nginx.com/nginx-ingress-controller
113121 org.opencontainers.image.vendor=NGINX Inc <[email protected] > 114- org.opencontainers.image.revision=${{ inputs.sha_long != '' && inputs.sha_long || github.sha }}
115122 io.artifacthub.package.readme-url=https://raw.githubusercontent.com/nginxinc/kubernetes-ingress/main/README.md
116123 io.artifacthub.package.logo-url=https://docs.nginx.com/nginx-ingress-controller/images/icons/NGINX-Ingress-Controller-product-icon.svg
117124 io.artifacthub.package.maintainers=[{"name":"NGINX Inc","email":"[email protected] "}] @@ -123,7 +130,7 @@ jobs:
123130 id : build-push
124131 with :
125132 file : build/Dockerfile
126- context : ' . '
133+ context : " . "
127134 cache-from : type=gha,scope=${{ inputs.image }}
128135 cache-to : type=gha,scope=${{ inputs.image }},mode=max
129136 target : goreleaser
@@ -141,36 +148,35 @@ jobs:
141148 IC_VERSION=${{ github.event_name == 'pull_request' && 'CI' || steps.meta.outputs.version }}
142149
143150 - name : Run Trivy vulnerability scanner
144- uses : aquasecurity/trivy-action@1f0aa582c8c8f5f7639610d6d38baddfea4fdcee # 0.9.2
151+ uses : aquasecurity/trivy-action@e5f43133f6e8736992c9f3c1b3296e24b37e17f2 # 0.10.0
145152 continue-on-error : true
146153 with :
147154 image-ref : nginx/nginx-ingress:${{ steps.meta.outputs.version }}
148- format : ' sarif'
149- output : ' trivy-results-${{ inputs.image }}.sarif'
150- ignore-unfixed : ' true'
155+ format : " sarif"
156+ output : " trivy-results-${{ inputs.image }}.sarif"
157+ ignore-unfixed : " true"
151158
152159 - name : Upload Trivy scan results to GitHub Security tab
153- uses : github/codeql-action/upload-sarif@04df1262e6247151b5ac09cd2c303ac36ad3f62b # v2.2.9
160+ uses : github/codeql-action/upload-sarif@f3feb00acb00f31a6f60280e6ace9ca31d91c76a # v2.3.2
154161 continue-on-error : true
155162 with :
156- sarif_file : ' trivy-results-${{ inputs.image }}.sarif'
163+ sarif_file : " trivy-results-${{ inputs.image }}.sarif"
157164
158165 - name : Upload Scan Results
159166 uses : actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
160167 continue-on-error : true
161168 with :
162- name : ' trivy-results-${{ inputs.image }}.sarif'
163- path : ' trivy-results-${{ inputs.image }}.sarif'
169+ name : " trivy-results-${{ inputs.image }}.sarif"
170+ path : " trivy-results-${{ inputs.image }}.sarif"
164171 if : always()
165172
166173 send-notification :
167- name : Send Notification
168- needs : build
169- uses : ./.github/workflows/updates-notification.yml
170- with :
171- sha_long : ${{ inputs.sha_long }}
172- tag : ${{ inputs.tag }}
173- version : ${{ needs.build.outputs.version }}
174- image_digest : ${{ needs.build.outputs.image_digest }}
175- secrets : inherit
176- if : ${{ inputs.tag != '' }}
174+ name : Send Notification
175+ needs : build
176+ uses : ./.github/workflows/updates-notification.yml
177+ with :
178+ tag : ${{ inputs.tag }}
179+ version : ${{ needs.build.outputs.version }}
180+ image_digest : ${{ needs.build.outputs.image_digest }}
181+ secrets : inherit
182+ if : ${{ inputs.tag != '' }}
0 commit comments