Skip to content

Merge pull request #7 from settle-finance/workflow #10

Merge pull request #7 from settle-finance/workflow

Merge pull request #7 from settle-finance/workflow #10

Workflow file for this run

name: Create Tag on Merge
on:
push:
branches:
- main
jobs:
create-tag:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Get latest tag (if available)
id: get-tag
run: |
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
- 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"
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"
git push origin ":refs/tags/$new_tag_version"