Skip to content

Commit 8ce7c6c

Browse files
committed
Update CI/CD pipeline to work on version release
1 parent bc872bb commit 8ce7c6c

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,48 @@
11
name: Build and Release
2+
23
on:
34
push:
45
branches:
56
- main
7+
tags:
8+
- 'v*'
9+
610
env:
711
REGISTRY: ghcr.io
812
IMAGE_NAME: ${{ github.repository }}
13+
914
jobs:
1015
build-and-push-images:
1116
runs-on: ubuntu-latest
1217
permissions:
1318
contents: read
1419
packages: write
20+
1521
steps:
1622
- name: Checkout repository
1723
uses: actions/checkout@v4
24+
1825
- name: Log in to the Container registry
19-
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
26+
uses: docker/login-action@v3
2027
with:
2128
registry: ${{ env.REGISTRY }}
2229
username: ${{ github.actor }}
2330
password: ${{ secrets.GITHUB_TOKEN }}
31+
2432
- name: Extract metadata (tags, labels) for Docker
2533
id: meta
26-
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
34+
uses: docker/metadata-action@v5
2735
with:
2836
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
29-
- name: Build and push Docker image (With commit hash)
30-
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
37+
tags: |
38+
type=sha,format=short
39+
type=ref,event=tag
40+
type=raw,value=latest
41+
42+
- name: Build and push Docker image
43+
uses: docker/build-push-action@v5
3144
with:
3245
context: .
3346
push: true
34-
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
47+
tags: ${{ steps.meta.outputs.tags }}
3548
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)