Skip to content

Commit 70a1d39

Browse files
authored
Add missing labels and remove unnecessary build-args (#188)
The metadata-action produces Docker labels automatically, with this change we add the output of that step to the build. GoReleaser already has the Version, Date and Commit hash info available, so we don't need to pass them as parameters to the build.
1 parent e79f235 commit 70a1d39

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ jobs:
3737
runs-on: ubuntu-20.04
3838
outputs:
3939
sha: ${{ steps.vars.outputs.sha }}
40-
version: ${{ steps.vars.outputs.version }}
41-
date: ${{ steps.vars.outputs.date }}
4240
go_path: ${{ steps.vars.outputs.go_path }}
4341
steps:
4442
- name: Checkout Repository
@@ -52,8 +50,6 @@ jobs:
5250
id: vars
5351
run: |
5452
echo "::set-output name=sha::$(echo ${GITHUB_SHA} | cut -c1-7)"
55-
echo "::set-output name=version::$(grep "VERSION = " Makefile | cut -d " " -f 3)"
56-
echo "::set-output name=date::$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
5753
echo "::set-output name=go_path::$(go env GOPATH)"
5854
- name: Check if go.mod and go.sum are up to date
5955
run: |
@@ -195,24 +191,23 @@ jobs:
195191
type=edge
196192
type=ref,event=pr
197193
type=ref,event=branch,suffix=-rc,enable=${{ startsWith(github.ref, 'refs/heads/release') }}
194+
198195
- name: Build Docker Image
199196
uses: docker/build-push-action@v3
200197
with:
201198
file: build/Dockerfile
202199
context: '.'
203200
target: goreleaser
204201
tags: ${{ steps.meta.outputs.tags }}
202+
labels: ${{ steps.meta.outputs.labels }}
205203
load: ${{ github.event_name == 'pull_request' }}
206204
push: ${{ github.event_name != 'pull_request' }}
207205
platforms: ${{ github.event_name != 'pull_request' && env.platforms || '' }}
208206
cache-from: type=gha
209207
cache-to: type=gha,mode=max
210208
pull: true
211209
no-cache: ${{ github.event_name != 'pull_request' }}
212-
build-args: |
213-
VERSION=${{ needs.vars.outputs.version }}
214-
GIT_COMMIT=${{ needs.vars.outputs.sha }}
215-
DATE=${{ needs.vars.outputs.date }}
210+
216211
- name: Run Trivy vulnerability scanner
217212
uses: aquasecurity/[email protected]
218213
continue-on-error: true

0 commit comments

Comments
 (0)