4949 # temporary work around for https://github.com/actions/checkout/issues/1169
5050 - run : git config --system --add safe.directory /__w/e2core/e2core
5151
52+ - uses : docker/metadata-action@v4
53+ id : docker_meta
54+ with :
55+ images : suborbital/e2core,ghcr.io/suborbital/e2core
56+ tags : |
57+ type=sha,enable=${{ !startsWith(github.ref, 'refs/tags/v') }}
58+ type=semver,pattern={{raw}}
59+ flavor : |
60+ latest=auto
61+
5262 - uses : goreleaser/goreleaser-action@v4
5363 with :
5464 version : latest
5868 run : goreleaser release --clean
5969 env :
6070 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
71+ VERSION : ${{ fromJSON(steps.docker_meta.outputs.json).labels['org.opencontainers.image.version'] }}
6172
6273 - if : ${{ !startsWith(github.ref, 'refs/tags/v') }}
6374 run : goreleaser release --clean --snapshot
75+ env :
76+ VERSION : ${{ fromJSON(steps.docker_meta.outputs.json).labels['org.opencontainers.image.version'] }}
6477
6578 image :
6679 needs : [lint, test]
@@ -70,10 +83,22 @@ jobs:
7083 - uses : docker/setup-buildx-action@v2
7184 - uses : docker/setup-qemu-action@v2
7285
86+ - uses : docker/metadata-action@v4
87+ id : docker_meta
88+ with :
89+ images : suborbital/e2core,ghcr.io/suborbital/e2core
90+ tags : |
91+ type=sha,enable=${{ !startsWith(github.ref, 'refs/tags/v') }}
92+ type=semver,pattern={{raw}}
93+ flavor : |
94+ latest=auto
95+
7396 - name : Build e2core image
7497 uses : docker/build-push-action@v4
7598 with :
7699 cache-from : type=gha
100+ build-args : |
101+ VERSION=${{ fromJSON(steps.docker_meta.outputs.json).labels['org.opencontainers.image.version'] }}
77102 load : true
78103 push : false
79104 tags : suborbital/e2core:dev
@@ -116,21 +141,13 @@ jobs:
116141 username : ${{ github.actor }}
117142 password : ${{ secrets.GITHUB_TOKEN }}
118143
119- - uses : docker/metadata-action@v4
120- if : startsWith(github.ref, 'refs/tags/v')
121- id : docker_meta
122- with :
123- images : suborbital/e2core,ghcr.io/suborbital/e2core
124- tags : |
125- type=match,pattern=(v.*)
126- flavor : |
127- latest=auto
128-
129144 - name : Build and push e2core image
130145 if : startsWith(github.ref, 'refs/tags/v')
131146 uses : docker/build-push-action@v4
132147 with :
133148 cache-from : type=gha
149+ build-args : |
150+ VERSION=${{ fromJSON(steps.docker_meta.outputs.json).labels['org.opencontainers.image.version'] }}
134151 cache-to : type=gha,mode=max
135152 platforms : linux/amd64,linux/arm64
136153 push : true
0 commit comments