Skip to content

Commit b50bce3

Browse files
authored
Same docker build on release. (#164)
* Tag with version tags when possible * Tag with sha * Always tag as latest By using docker/metadata-action also get all the standard opencontainer labels so renovate/dependabot/updatecli/etc can generate pull requests with release notes
1 parent 40a3ed9 commit b50bce3

File tree

1 file changed

+27
-13
lines changed

1 file changed

+27
-13
lines changed

.github/workflows/build.yml

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,43 @@ on:
44
push:
55
branches:
66
- main
7+
release:
8+
types:
9+
- published
710

811
jobs:
912
publish:
1013
name: Publish Docker Container
1114
runs-on: ubuntu-latest
1215
steps:
13-
-
14-
name: Set up QEMU
15-
uses: docker/setup-qemu-action@v3
16-
-
17-
name: Set up Docker Buildx
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Docker Buildx
1820
uses: docker/setup-buildx-action@v3
19-
-
20-
name: Login to GitHub Container Registry
21-
uses: docker/login-action@v1
21+
22+
- name: Log in to the Container registry
23+
uses: docker/login-action@v3
2224
with:
2325
registry: ghcr.io
24-
username: ${{ github.actor }}
26+
username: ${{ github.repository_owner }}
2527
password: ${{ secrets.GITHUB_TOKEN }}
26-
-
27-
name: Build and push server
28+
29+
- name: Extract metadata (tags, labels) for Docker
30+
id: meta
31+
uses: docker/metadata-action@v5
32+
with:
33+
images: "ghcr.io/${{ github.repository_owner }}/kobodl"
34+
tags: |
35+
type=raw,value=latest
36+
type=semver,pattern={{version}}
37+
type=sha
38+
39+
- name: Build and push Docker image
2840
uses: docker/build-push-action@v6
2941
with:
30-
platforms: linux/amd64,linux/arm64
31-
tags: ghcr.io/subdavis/kobodl:latest
42+
context: .
3243
push: true
44+
platforms: "linux/amd64,linux/arm64"
45+
tags: ${{ steps.meta.outputs.tags }}
46+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)