Skip to content

Commit bce26d6

Browse files
committed
CI: Fix TestPyPI "dev0" versions for master commits on tags
This fixes a problem in the custom versions `v1.37.0.devN` built for publishing on TestPyPI since commit 325fafa "Publish each master commit with a unique version on TestPyPI". Such versions are constructed by suffixing `.devN`, where `N` is the number of commits since last tags. In the `N = 0` case, we need to add `--long` to `git describe --tags`. Otherwise it yields `v1.37.0` instead of `v1.37.0-0-gbe92e15`, and the CI fails, e.g. on https://github.com/adrienverge/yamllint/actions/runs/14017589005/job/39245225221 packaging.version.InvalidVersion: Invalid version: '1.37.0.devv1.37.0'
1 parent be92e15 commit bce26d6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

.github/workflows/publish.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ jobs:
2424
- name: Add '.devN' to version for non-tag builds
2525
if: github.ref_type != 'tag'
2626
run:
27+
N=$(git describe --tags --long | cut -d- -f2);
2728
sed -i
28-
"/^APP_VERSION = /s/'$/.dev$(git describe --tags | cut -d- -f2)'/"
29+
"/^APP_VERSION = /s/'$/.dev$N'/"
2930
yamllint/__init__.py
3031
- name: Build a binary wheel and a source tarball
3132
run: python -m build

0 commit comments

Comments
 (0)