Skip to content

Commit 2a9b0af

Browse files
committed
correct workflow package version
1 parent 62a5d38 commit 2a9b0af

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.github/workflows/build-test-package-publish.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ jobs:
141141
fetch-depth: 0
142142

143143
- run: git describe --tag
144+
- run: git describe --tag --long --first-parent --match "v[0-9]*"
144145

145146
- name: setup python environment
146147
id: setup-python
@@ -180,10 +181,11 @@ jobs:
180181
run: npm install --also=dev
181182

182183
- name: update versions from git
184+
if: ${{ !startsWith( github.ref, 'refs/tags/v') }}
183185
run: poetry run python ./scripts/update_git_versions.py
184186

185187
- name: update doc links
186-
if: ${{ !startsWith( github.ref, 'refs/tags/v') }}
188+
if: ${{ startsWith( github.ref, 'refs/tags/v') }}
187189
run: poetry run npm run update-doc-links
188190

189191
- name: package

scripts/tools.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,15 @@ class GitDescribeVersion(NamedTuple):
1515
def get_current_version_from_git() -> Version:
1616
repo = Repo(Path.cwd())
1717

18-
git_version = GitDescribeVersion(*repo.git.describe("--long", "--match", "v[0-9]*").split("-"))
18+
git_version = GitDescribeVersion(
19+
*repo.git.describe("--tag", "--long", "--first-parent", "--match", "v[0-9]*").split("-")
20+
)
21+
1922
version = Version(git_version.version[1:])
2023
if git_version.commits is not None and git_version.commits != "0":
2124
version = version.next_patch()
2225
version.prerelease = ("dev", git_version.commits)
26+
2327
return version
2428

2529

0 commit comments

Comments
 (0)