Skip to content

Commit

Permalink
Update Workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
sharansalian committed May 10, 2024
1 parent 8a53c3b commit a53dfa1
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions .github/workflows/on_merge_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,27 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2

- name: Create Tag
- name: Get latest tag (if available)
id: get-tag
run: |
# Get the latest tag from the main branch
latest_tag=$(git describe --tags --abbrev=0)
# Extract the tag version number
tag_version=$(echo "$latest_tag" | grep -oP '\d+\.\d+\.\d+')
if latest_tag=$(git describe --tags --abbrev=0 2>/dev/null); then
echo "::set-output name=tag::$latest_tag"
else
echo "::set-output name=tag::"
fi
# Increment the minor version number
- name: Create Tag
if: steps.get-tag.outputs.tag != ''
run: |
tag_version=$(echo "${{ steps.get-tag.outputs.tag }}" | grep -oP '\d+\.\d+\.\d+')
IFS='.' read -r major minor patch <<< "$tag_version"
new_minor=$((minor + 1))
new_tag_version="$major.$new_minor.$patch"
# Create the new tag and push it
git tag -a "$new_tag_version" -m "Automated tag creation on branch merge"
git push origin "$new_tag_version"
- name: Clean up
if: steps.get-tag.outputs.tag != ''
run: |
git fetch --tags
git tag -d "$new_tag_version"
Expand Down

0 comments on commit a53dfa1

Please sign in to comment.