Skip to content

Commit e31c48b

Browse files
committed
fix version validation
1 parent 60193a9 commit e31c48b

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,18 @@ jobs:
6363
git tag -v "$TAG_NAME"
6464
6565
# verify version
66-
just validate_version $TAG_NAME
66+
RELEASE_VERSION=$(just validate_version $TAG_NAME)
6767
6868
# check that github has marked the tag as verified
69-
export TAG_URL=`curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository_owner }}/${{ github.repository }}/git/refs/tags/$TAG_NAME | jq -r ".object.url"`
69+
export TAG_URL=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository_owner }}/${{ github.repository }}/git/refs/tags/$TAG_NAME | jq -r ".object.url")
7070
result=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "$TAG_URL" | jq -r ".verification.verified")
7171
if [ "$result" != "true" ]; then
7272
echo "Error: Tag verification failed." >&2
7373
exit 1
7474
fi
7575
7676
# export the release version
77-
echo "RELEASE_VERSION=${TAG_NAME}" >> $GITHUB_ENV
77+
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV
7878
- name: Build the binary wheel and a source tarball
7979
run: just build
8080
- name: Store the distribution packages

justfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,10 @@ validate_version VERSION:
212212
import re
213213
import tomllib
214214
import django_enum
215-
assert re.match(r"\d+[.]\d+[.]\w+", "{{ VERSION }}")
216-
assert "{{ VERSION }}" == tomllib.load(open('pyproject.toml', 'rb'))['project']['version']
217-
assert "{{ VERSION }}" == django_enum.__version__
215+
version = re.match(r"v?(\d+[.]\d+[.]\w+)", "{{ VERSION }}").groups()[0]
216+
assert version == tomllib.load(open('pyproject.toml', 'rb'))['project']['version']
217+
assert version == django_enum.__version__
218+
print(version)
218219

219220
# issue a relase for the given semver string (e.g. 2.1.0)
220221
release VERSION:

0 commit comments

Comments
 (0)