Merge pull request #55 from pratikkumar-mohite/pm/issue-34 #55
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
update-tag: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Configure Git | |
run: | | |
git config user.name "Pratikkumar Mohite" | |
git config user.email "mohite770.pm@gmail.com" | |
- name: Update the latest tag | |
id: update_latest_tag | |
run: | | |
git fetch --tags | |
latest_tag="$(git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1)" | |
if [ -z "$latest_tag" ]; then | |
latest_tag="v0.0.1" | |
echo "new_tag=$latest_tag" >> $GITHUB_OUTPUT | |
else | |
echo $latest_tag | |
IFS='.' read -ra version_parts <<< "$latest_tag" | |
major=${version_parts[0]} | |
minor=${version_parts[1]} | |
patch=${version_parts[2]} | |
new_patch=$((patch + 1)) | |
new_tag="$major.$minor.$new_patch" | |
echo "new_tag=$new_tag" >> $GITHUB_OUTPUT | |
fi | |
- name: Create and push new tag | |
run: | | |
new_tag=${{ steps.update_latest_tag.outputs.new_tag }} | |
git tag -a $new_tag -m "Release $new_tag" | |
git push origin $new_tag |