@@ -2,11 +2,11 @@ name: CI
22
33on :
44 push :
5- branches : [ "main" ]
5+ branches : ["main"]
66 # Publish semver tags as releases.
7- tags : [ ' v*.*.*' ]
7+ tags : [" v*.*.*" ]
88 pull_request :
9- branches : [ "main" ]
9+ branches : ["main"]
1010
1111env :
1212 REGISTRY : docker.io
1616 CLOUD_BUILDER_NAME : test-ci
1717jobs :
1818 ci :
19-
2019 runs-on : ubuntu-latest
2120 permissions :
2221 contents : read # Ler o conteúdo do repositório
@@ -29,19 +28,19 @@ jobs:
2928 - name : Checkout repository
3029 uses : actions/checkout@v4
3130
31+ - name : Log into registry ${{ env.REGISTRY }}
32+ uses : docker/login-action@v3
33+ with :
34+ registry : ${{ env.REGISTRY }}
35+ username : ${{ env.DOCKER_USERNAME }}
36+ password : ${{ secrets.DOCKER_TOKEN }}
37+
3238 - name : Set up Docker Buildx
3339 uses : docker/setup-buildx-action@v3
3440 with :
3541 driver : cloud
3642 endpoint : " ${{ env.DOCKER_USERNAME }}/${{ env.CLOUD_BUILDER_NAME }}"
3743
38- - name : Log into registry ${{ env.REGISTRY }}
39- uses : docker/login-action@v3
40- with :
41- # registry: ${{ env.REGISTRY }}
42- username : ${{ env.DOCKER_USERNAME }}
43- password : ${{ secrets.DOCKER_TOKEN }}
44-
4544 - name : Build for CI
4645 id : build-ci
4746@@ -56,13 +55,13 @@ jobs:
5655 cache-to : type=gha,mode=max
5756 secrets : |
5857 github_token=${{ secrets.MY_GITHUB_TOKEN }}
59-
58+
6059 - name : Up containers
6160 run : docker compose -f ./src/ci/nestjs-project/compose.ci.yaml up -d --wait-timeout 10
62-
61+
6362 - name : Run tests
6463 run : echo "Running tests..."
65-
64+
6665 - name : Build for analysis
6766 id : build-for-analysis
68677675 cache-to : type=gha,mode=max
7776 secrets : |
7877 github_token=${{ secrets.MY_GITHUB_TOKEN }}
79-
78+
8079 - name : Analyze for critical and high CVEs
8180 id : docker-scout-cves
8281 uses : docker/scout-action@v1
8786 only-fixed : true
8887 summary : true # publicar github actions e pull request
8988 exit-code : true
90-
89+
9190 - name : Analyze for all CVEs
9291 id : docker-scout-all-cves
9392 uses : docker/scout-action@v1
@@ -103,7 +102,7 @@ jobs:
103102 uses : github/codeql-action/upload-sarif@v3
104103 with :
105104 sarif_file : sarif.output.json
106-
105+
107106 - name : Extract Docker metadata
108107 id : meta
109108 if : github.event_name != 'pull_request'
@@ -116,7 +115,7 @@ jobs:
116115 type=edge,branch=$repo.default_branch
117116 type=semver,pattern=v{{version}}
118117 type=sha,prefix=,suffix=,format=short
119-
118+
120119 - name : Build final
121120 id : build-final
122121 if : github.event_name != 'pull_request'
@@ -133,17 +132,16 @@ jobs:
133132 sbom : true
134133 secrets : |
135134 github_token=${{ secrets.MY_GITHUB_TOKEN }}
136-
135+
137136 - name : Install cosign
138137 if : github.event_name != 'pull_request'
139138140139 with :
141- cosign-release : ' v2.2.4'
142-
140+ cosign-release : " v2.2.4"
141+
143142 - name : Sign the published Docker image
144143 if : github.event_name != 'pull_request'
145144 env :
146145 TAGS : ${{ steps.meta.outputs.tags }}
147146 DIGEST : ${{ steps.build-final.outputs.digest }}
148147 run : echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
149-
0 commit comments