2222 packages : write # Permitir publicar pacotes no GitHub Packages
2323 pull-requests : write # Permitir criar e atualizar pull requests
2424 security-events : write # Enviar eventos de segurança para o Github Security
25+ id-token : write # Permitir emitir tokens OIDC para autenticação com provedores externos
2526
2627 steps :
2728 - name : Checkout repository
@@ -101,7 +102,7 @@ jobs:
101102
102103 - name : Extract Docker metadata
103104 id : meta
104- if : ${{ github.event_name != 'pull_request' }}
105+ if : github.event_name != 'pull_request'
105106106107 with :
107108 images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
@@ -114,7 +115,7 @@ jobs:
114115
115116 - name : Build final
116117 id : build-final
117- if : ${{ github.event_name != 'pull_request' }}
118+ if : github.event_name != 'pull_request'
118119119120 with :
120121 context : ./src/ci/nestjs-project
@@ -128,3 +129,17 @@ jobs:
128129 sbom : true
129130 secrets : |
130131 github_token=${{ secrets.MY_GITHUB_TOKEN }}
132+
133+ - name : Install cosign
134+ if : github.event_name != 'pull_request'
135+ 136+ with :
137+ cosign-release : ' v2.2.4'
138+
139+ - name : Sign the published Docker image
140+ if : github.event_name != 'pull_request'
141+ env :
142+ TAGS : ${{ steps.meta.outputs.tags }} docker metadata tag1,tag2,tag3
143+ DIGEST : ${{ steps.build-final.outputs.digest }}
144+ run : echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
145+
0 commit comments