Skip to content

Commit 3a5c774

Browse files
committed
task: add release workflow
1 parent 5b7033f commit 3a5c774

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Build and push Image
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
- name: Log in to the Container registry
19+
uses: docker/login-action@v3
20+
with:
21+
registry: ${{ env.REGISTRY }}
22+
username: ${{ github.actor }}
23+
password: ${{ secrets.GITHUB_TOKEN }}
24+
- name: Extract metadata (tags, labels)
25+
uses: docker/metadata-action@v5
26+
id: meta
27+
with:
28+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
29+
tags: |
30+
type=semver,pattern={{version}}
31+
type=sha
32+
# set latest tag for default branch
33+
type=raw,value=latest,enable={{is_default_branch}}
34+
- name: Build and push image
35+
uses: docker/build-push-action@v6
36+
with:
37+
context: .
38+
push: true
39+
tags: ${{ steps.meta.outputs.tags }}
40+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)