Skip to content

Commit da9444e

Browse files
adds tags workflo
1 parent f9f343d commit da9444e

File tree

2 files changed

+51
-2
lines changed

2 files changed

+51
-2
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
name: Docker Build
1+
name: Build Image
22

33
on:
4-
push:
4+
workflow_call:
55
workflow_dispatch:
66

77
jobs:
@@ -45,6 +45,7 @@ jobs:
4545
uses: docker/build-push-action@v6
4646
with:
4747
push: true
48+
labels: ${{ steps.meta.outputs.labels }}
4849
tags: ${{ steps.meta.outputs.tags }}
4950

5051
test:

.github/workflows/tag.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Tag Image
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
jobs:
8+
tag:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v4
13+
14+
- name: Set up QEMU
15+
uses: docker/setup-qemu-action@v3
16+
17+
- name: Set up Docker Buildx
18+
uses: docker/setup-buildx-action@v3
19+
20+
- name: Login to GitHub Container Registry
21+
uses: docker/login-action@v3
22+
with:
23+
registry: ghcr.io
24+
username: ${{ github.actor }}
25+
password: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- name: Determine long-lived Docker image tags
28+
id: meta
29+
uses: docker/metadata-action@v5
30+
with:
31+
images: ghcr.io/${{ github.repository }}
32+
tags: |
33+
type=sha
34+
type=ref,event=branch
35+
type=ref,event=tag
36+
type=semver,pattern={{major}}
37+
type=semver,pattern={{major}}.{{minor}}
38+
type=semver,pattern={{version}}
39+
type=raw,value=latest,enable={{is_default_branch}}
40+
41+
- name: Retag and push the image
42+
uses: docker/build-push-action@v2
43+
with:
44+
push: true
45+
labels: ${{ steps.meta.outputs.labels }}
46+
tags: ${{ steps.meta.outputs.tags }}
47+
cache-from: type=registry,ref=${{ github.repository }}
48+
cache-to: type=inline

0 commit comments

Comments
 (0)