Skip to content

Commit daae636

Browse files
committed
chore: major, minor version docker tags + pr tags
1 parent 9421613 commit daae636

1 file changed

Lines changed: 18 additions & 10 deletions

File tree

.github/workflows/docker.yml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ on:
1818
paths-ignore:
1919
- "docs/**"
2020
- "README.md"
21+
- ".env.example"
22+
pull_request:
23+
branches:
24+
- "main"
2125

2226
workflow_dispatch:
2327

@@ -54,31 +58,35 @@ jobs:
5458
runs-on: ubuntu-latest
5559
steps:
5660
- uses: actions/checkout@v4
57-
5861
- name: Log in to Docker Hub
5962
uses: docker/login-action@v3
6063
with:
6164
username: ${{ secrets.DOCKER_USERNAME }}
6265
password: ${{ secrets.DOCKER_TOKEN }}
63-
6466
- name: Set up Docker Buildx
6567
uses: docker/setup-buildx-action@v3
66-
67-
- name: Extract tag version
68-
run: echo "KOITO_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
69-
68+
- name: Extract metadata
69+
id: meta
70+
uses: docker/metadata-action@v6
71+
with:
72+
images: gabehf/koito
73+
tags: |
74+
type=semver,pattern={{version}}
75+
type=semver,pattern={{major}}.{{minor}}
76+
type=semver,pattern={{major}}
77+
flavor: |
78+
prefix=v
7079
- name: Build and push release image
7180
id: push
7281
uses: docker/build-push-action@v6
7382
with:
7483
context: .
7584
file: ./Dockerfile
7685
push: true
77-
tags: |
78-
gabehf/koito:latest
79-
gabehf/koito:${{ env.KOITO_VERSION }}
86+
tags: ${{ steps.meta.outputs.tags }}
87+
labels: ${{ steps.meta.outputs.labels }}
8088
build-args: |
81-
KOITO_VERSION=${{ env.KOITO_VERSION }}
89+
KOITO_VERSION=${{ steps.meta.outputs.version }}
8290
platforms: linux/amd64,linux/arm64
8391

8492
push_dev:

0 commit comments

Comments
 (0)