File tree Expand file tree Collapse file tree 3 files changed +54
-16
lines changed
Expand file tree Collapse file tree 3 files changed +54
-16
lines changed Original file line number Diff line number Diff line change 55 branches :
66 - master
77
8+ env :
9+ REGISTRY : ghcr.io
10+ IMAGE_NAME : ${{ github.repository }}
11+
812jobs :
913 build :
1014 runs-on : ubuntu-latest
@@ -27,11 +31,20 @@ jobs:
2731 - name : Lint
2832 uses : golangci/golangci-lint-action@v7
2933
30- - name : Docker Image
31- run : |
32- docker build -f Dockerfile -t ghcr.io/metal-stack/metal-console .
33- docker push ghcr.io/metal-stack/metal-console
34-
34+ - name : Make tag
35+ run : echo "tag=latest" >> $GITHUB_ENV || true
36+
37+ - name : Set up Docker Buildx
38+ uses : docker/setup-buildx-action@v3
39+
40+ - name : Build and push image
41+ uses : docker/build-push-action@v6
42+ with :
43+ context : .
44+ push : true
45+ sbom : true
46+ tags : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.tag }}
47+
3548 - uses : release-drafter/release-drafter@v6
3649 env :
3750 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change 55 branches :
66 - master
77
8+ env :
9+ REGISTRY : ghcr.io
10+ IMAGE_NAME : ${{ github.repository }}
11+
812jobs :
913 build :
1014 runs-on : ubuntu-latest
@@ -32,14 +36,23 @@ jobs:
3236 - name : Lint
3337 uses : golangci/golangci-lint-action@v7
3438
35- - name : Build Docker image
36- run : |
37- export GITHUB_TAG_NAME=${GITHUB_HEAD_REF##*/}
38- docker build -f Dockerfile -t ghcr.io/metal-stack/metal-console:pr-${GITHUB_TAG_NAME} .
39+ - name : Make tag
40+ run : echo "tag=pr-${GITHUB_HEAD_REF##*/}" >> $GITHUB_ENV || true
41+
42+ - name : Set up Docker Buildx
43+ uses : docker/setup-buildx-action@v3
44+
45+ - name : Build and push image
46+ uses : docker/build-push-action@v6
47+ with :
48+ context : .
49+ load : true
50+ push : false
51+ sbom : true
52+ tags : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.tag }}
3953
4054 - name : Push Docker image
4155 run : |
42- export GITHUB_TAG_NAME=${GITHUB_HEAD_REF##*/}
4356 # pull request images are prefixed with 'pr' to prevent them from overriding released images
44- docker push ghcr.io/metal-stack/metal-console:pr-${GITHUB_TAG_NAME }
57+ docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.tag } }
4558 if : steps.fork.outputs.is_fork_pr == 'false'
Original file line number Diff line number Diff line change 55 types :
66 - published
77
8+ env :
9+ REGISTRY : ghcr.io
10+ IMAGE_NAME : ${{ github.repository }}
11+
812jobs :
913 build :
1014 runs-on : ubuntu-latest
2731 - name : Lint
2832 uses : golangci/golangci-lint-action@v7
2933
30- - name : Build the Docker images
31- run : |
32- export GITHUB_TAG_NAME=${GITHUB_REF##*/}
33- docker build -f Dockerfile -t ghcr.io/metal-stack/metal-console:${GITHUB_TAG_NAME} .
34- docker push ghcr.io/metal-stack/metal-console:${GITHUB_TAG_NAME}
34+ - name : Make tag
35+ run : echo "tag=${GITHUB_REF##*/}" >> $GITHUB_ENV || true
36+
37+ - name : Set up Docker Buildx
38+ uses : docker/setup-buildx-action@v3
39+
40+ - name : Build and push image
41+ uses : docker/build-push-action@v6
42+ with :
43+ context : .
44+ push : true
45+ sbom : true
46+ tags : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.tag }}
You can’t perform that action at this time.
0 commit comments