Skip to content

Commit 41925c4

Browse files
authored
Merge pull request #14 from silinternational/develop
Changed in the Branch setting and tags
2 parents 9ed8e80 + 6e49cb1 commit 41925c4

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

.github/workflows/build-and-publish.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ name: Build and Publish
22

33
on:
44
push:
5+
branches: [ 'main', 'master' ] # Trigger on push to 'main'& 'master' master will be remove step by step
6+
tags: [ '[0-9]+.[0-9]+.[0-9]+' ] # Trigger on version tags like '0.1.0'
57

68
jobs:
79
build-and-publish:
8-
name: Build and Publish
10+
name: Build and Publish Docker image
911
runs-on: ubuntu-latest
1012
steps:
1113
- name: Checkout code
@@ -17,13 +19,31 @@ jobs:
1719
username: ${{ secrets.DOCKERHUB_USERNAME }}
1820
password: ${{ secrets.DOCKERHUB_TOKEN }}
1921

22+
- name: Log in to GitHub Container Registry
23+
uses: docker/login-action@v3
24+
with:
25+
registry: ghcr.io
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
2029
- name: Extract metadata (tags, labels) for Docker
2130
id: meta
2231
uses: docker/metadata-action@v5
2332
with:
24-
images: ${{ vars.DOCKER_ORG }}/${{ github.event.repository.name }}
33+
images: |
34+
${{ vars.DOCKER_ORG }}/${{ github.event.repository.name }}
35+
ghcr.io/${{ github.repository }}
36+
tags: |
37+
type=ref,event=branch # Tag with branch name
38+
type=semver,pattern={{version}}
39+
type=semver,pattern={{major}}.{{minor}}
40+
type=semver,pattern={{major}}
41+
# labels: |
42+
# org.opencontainers.image.source=${{ github.repository }}
43+
# org.opencontainers.image.revision=${{ github.sha }}
44+
# org.opencontainers.image.created=${{ github.event.head_commit.timestamp }}
2545

26-
- name: Build and push Docker image
46+
- name: Build and push Docker image to DockerHub and GHCR
2747
uses: docker/build-push-action@v5
2848
with:
2949
context: .

0 commit comments

Comments
 (0)