From 9df6fe4ab1fee6c20706b82956308cfa0b101cb3 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Wed, 7 Jun 2023 00:24:32 -0400 Subject: [PATCH] Release job version verification checks for an exact match The step in the release process that checks whether a release number has already been used, we are failing while trying to ship v2.2.2 because v2.2.2rc1 already exists. We need to check for an exact match rather than doing a simple grep match. Use `git rev-parse` to do an exact match check for whether a git tag already exists. --- .github/workflows/publish-to-pypi.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-to-pypi.yaml b/.github/workflows/publish-to-pypi.yaml index 1c06e6bd..205c1acc 100644 --- a/.github/workflows/publish-to-pypi.yaml +++ b/.github/workflows/publish-to-pypi.yaml @@ -65,8 +65,9 @@ jobs: - name: Verify unique release number run: | - if git tag -l | grep -q ${{ steps.bump.outputs.VERSION_TAG }}; then - echo "Tag ${{ steps.bump.outputs.VERSION_TAG }} already exists, aborting" + TAG_NAME=${{ steps.bump.outputs.VERSION_TAG }} + if git rev-parse -q --verify "refs/tags/$TAG_NAME" >/dev/null; then + echo "Tag $TAG_NAME already exists." exit 1 fi