@@ -48,14 +48,23 @@ jobs:
48
48
- name : Set up Docker Buildx
49
49
uses : docker/setup-buildx-action@v3
50
50
51
- - name : Extract metadata (tags, labels) for Docker
52
- id : meta
51
+ - name : Extract metadata (tags, labels) for Docker (tag)
52
+ id : meta-tag
53
+ if : github.ref_type == 'tag'
53
54
uses : docker/metadata-action@v5
54
55
with :
55
56
images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
56
57
tags : |
57
58
type=semver,pattern={{version}}
58
59
type=semver,pattern={{major}}.{{minor}}
60
+
61
+ - name : Extract metadata (tags, labels) for Docker (branch)
62
+ id : meta-branch
63
+ if : github.ref_type == 'branch'
64
+ uses : docker/metadata-action@v5
65
+ with :
66
+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
67
+ tags : |
59
68
type=ref,event=branch
60
69
type=sha,prefix={{branch}}-
61
70
@@ -66,10 +75,20 @@ jobs:
66
75
username : ${{ github.repository_owner }}
67
76
password : ${{ secrets.GITHUB_TOKEN }}
68
77
69
- - name : Build and push Docker image
78
+ - name : Build and push Docker image (tag)
79
+ if : github.ref_type == 'tag'
80
+ uses : docker/build-push-action@v5
81
+ with :
82
+ file : scripts/hyperspace.Dockerfile
83
+ push : ${{ github.event_name != 'pull_request' }}
84
+ tags : ${{ steps.meta-tag.outputs.tags }}
85
+ labels : ${{ steps.meta-tag.outputs.labels }}
86
+
87
+ - name : Build and push Docker image (branch)
88
+ if : github.ref_type == 'branch'
70
89
uses : docker/build-push-action@v5
71
90
with :
72
91
file : scripts/hyperspace.Dockerfile
73
92
push : ${{ github.event_name != 'pull_request' }}
74
- tags : ${{ steps.meta.outputs.tags }}
75
- labels : ${{ steps.meta.outputs.labels }}
93
+ tags : ${{ steps.meta-branch .outputs.tags }}
94
+ labels : ${{ steps.meta-branch .outputs.labels }}
0 commit comments