Skip to content

Commit

Permalink
Merge pull request #20 from Food-fusion-Fiap/update-tag
Browse files Browse the repository at this point in the history
update tag
  • Loading branch information
CAVAh authored Jul 15, 2024
2 parents efd90e1 + ebe069f commit d5981e3
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/ci-cd-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,19 @@ jobs:
- name: Calculate next tag
id: tagger
run: |
TAG="0.1.0" # Initialize with the starting version
LATEST_TAG=$(git tag --sort=-v:refname | head -n 1)
if [ ! -z "$LATEST_TAG" ]; then
TAG=$(echo $LATEST_TAG | awk -F. '{$NF+=1; OFS="."; print $0}')
TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
LATEST_TAG=$TAG
if [[ "$LATEST_TAG" =~ ^v([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
major="${BASH_REMATCH[1]}"
minor="${BASH_REMATCH[2]}"
patch="${BASH_REMATCH[3]}"
next_patch=$((patch + 1))
NEXT_TAG="v${major}.${minor}.${next_patch}"
echo "NEXT_TAG=$NEXT_TAG" >> $GITHUB_ENV
else
echo "LATEST_TAG is not a semantic version, defaulting to v1.0.0"
echo "IMAGE_TAG=v1.0.0" >> $GITHUB_ENV
fi
echo "Next tag: $TAG"
echo "::set-output name=next_tag::$TAG"
- name: Build, tag, and push Docker image to Amazon ECR
env:
Expand Down

0 comments on commit d5981e3

Please sign in to comment.