diff --git a/.github/workflows/update-version-number.yaml b/.github/workflows/update-version-number.yaml index 1afa6ca..2bfddb5 100644 --- a/.github/workflows/update-version-number.yaml +++ b/.github/workflows/update-version-number.yaml @@ -18,12 +18,14 @@ jobs: git config user.email bot@thms.uk VERSION=${{ github.ref_name }} VERSION="${VERSION:1}" - sed -i -E 's/VERSION = "[0-9]+.[0-9]+.[0-9]+"/VERSION = "'$VERSION'"/' find_posts.py - git add find_posts.py - git commit -m "[bot] Bump version to $VERSION" - git push origin HEAD:main > /dev/null 2>&1 - git tag -f "v$VERSION" - git push -f origin "v$VERSION" > /dev/null 2>&1 + if ! grep "VERSION = \"$VERSION\"" "find_posts.py"; then + sed -i -E 's/VERSION = "[0-9]+.[0-9]+.[0-9]+"/VERSION = "'$VERSION'"/' find_posts.py + git add find_posts.py + git commit -m "[bot] Bump version to $VERSION" + git push origin HEAD:main > /dev/null 2>&1 + git tag -f "v$VERSION" + git push -f origin "v$VERSION" > /dev/null 2>&1 + fi docker: runs-on: ubuntu-latest