Skip to content

Commit 73d0334

Browse files
committed
Update docker-publish.yml
Signed-off-by: Md Imran <[email protected]>
1 parent d391a16 commit 73d0334

File tree

1 file changed

+3
-52
lines changed

1 file changed

+3
-52
lines changed

.github/workflows/docker-publish.yml

+3-52
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
1-
name: Docker Publish and Versioning
1+
name: Docker Latest Version
22

33
on:
44
push:
55
branches:
66
- "master"
7-
tags:
8-
- 'v*.*.*'
97
pull_request:
108
branches:
119
- "master"
1210
workflow_dispatch:
13-
14-
env:
15-
# Docker Hub registry URL (use docker.io for Docker Hub)
16-
REGISTRY: docker.io
17-
IMAGE_NAME: ${{ github.repository }}
18-
1911
jobs:
2012
build:
2113
runs-on: ubuntu-latest
@@ -27,35 +19,6 @@ jobs:
2719
- name: Checkout repository
2820
uses: actions/checkout@v4
2921

30-
- name: Set up Git versioning
31-
id: version
32-
run: |
33-
# Set version based on commit message prefix (fix, feat, chore or improvement)
34-
latest_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
35-
commit_message=$(git log -1 --pretty=%B)
36-
version_prefix=${latest_tag#v}
37-
major=$(echo $version_prefix | cut -d'.' -f1)
38-
minor=$(echo $version_prefix | cut -d'.' -f2)
39-
patch=$(echo $version_prefix | cut -d'.' -f3)
40-
41-
if [[ "$commit_message" =~ ^feat\(.*\) ]]; then
42-
# Bump major version, reset minor and patch
43-
major=$((major + 1))
44-
minor=0
45-
patch=0
46-
elif [[ "$commit_message" =~ ^fix\(.*\) ]]; then
47-
# Bump patch version
48-
patch=$((patch + 1))
49-
elif [[ "$commit_message" =~ ^chore\(.*\) || "$commit_message" =~ ^improvement\(.*\) ]]; then
50-
# Bump minor version, reset patch
51-
minor=$((minor + 1))
52-
patch=0
53-
fi
54-
55-
new_version="v$major.$minor.$patch"
56-
echo "new_version=$new_version" >> $GITHUB_ENV
57-
echo "New Version: $new_version"
58-
5922
# Install cosign tool, only run if it's not a pull request
6023
- name: Install cosign
6124
if: github.event_name != 'pull_request'
@@ -81,9 +44,7 @@ jobs:
8144
uses: docker/[email protected]
8245
with:
8346
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
84-
tags: |
85-
${{ env.new_version }}
86-
latest
47+
tags: latest
8748

8849
# Build and push Docker image, skip pushing on PRs
8950
- name: Build and push Docker image
@@ -92,17 +53,7 @@ jobs:
9253
with:
9354
context: .
9455
push: ${{ github.event_name != 'pull_request' }}
95-
tags: |
96-
${{ steps.meta.outputs.tags }}
97-
latest
56+
tags: latest
9857
labels: ${{ steps.meta.outputs.labels }}
9958
cache-from: type=gha
10059
cache-to: type=gha,mode=max
101-
102-
# Sign the resulting Docker image digest except on PRs
103-
# - name: Sign the published Docker image
104-
# if: ${{ github.event_name != 'pull_request' }}
105-
# env:
106-
# TAGS: ${{ steps.meta.outputs.tags }}
107-
# DIGEST: ${{ steps.build-and-push.outputs.digest }}
108-
# run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}

0 commit comments

Comments
 (0)