Skip to content

Commit 554e607

Browse files
committed
fix: clean up formatting and streamline Docker login step in CI workflow
1 parent d5f0e97 commit 554e607

File tree

1 file changed

+20
-22
lines changed

1 file changed

+20
-22
lines changed

.github/workflows/ci.yaml

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ name: CI
22

33
on:
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

1111
env:
1212
REGISTRY: docker.io
@@ -16,7 +16,6 @@ env:
1616
CLOUD_BUILDER_NAME: test-ci
1717
jobs:
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
uses: docker/[email protected]
@@ -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
6867
uses: docker/[email protected]
@@ -76,7 +75,7 @@ jobs:
7675
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
@@ -87,7 +86,7 @@ jobs:
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'
139138
uses: sigstore/[email protected]
140139
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

Comments
 (0)