Skip to content

Commit c60dbfd

Browse files
committed
get version using project metadata
1 parent 97cf82c commit c60dbfd

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,19 @@ jobs:
4040
with:
4141
persist-credentials: false
4242

43+
- name: Install build
44+
run: python -Im pip install build
45+
4346
- name: Get the dist version
4447
id: dist-version
45-
run: >-
46-
echo "version=$(
47-
grep ^__version__ src/trio/_version.py
48-
| sed 's#__version__ = "\([^"]\+\)"#\1#'
49-
)"
50-
>> "${GITHUB_OUTPUT}"
48+
shell: python
49+
run: |
50+
import os
51+
import build.util
52+
version = build.util.project_wheel_metadata(".").version
53+
54+
with open(os.environ["GITHUB_OUTPUT"], mode="a", encoding="utf8") as f:
55+
f.write(f"version={version}")
5156
5257
- name: Set the expected dist artifact names
5358
id: artifact-name
@@ -58,9 +63,6 @@ jobs:
5863
DIST_NAME: ${{ env.dist-name }}
5964
VERSION: ${{ steps.dist-version.outputs.version }}
6065

61-
- name: Install build
62-
run: python -Im pip install build
63-
6466
- name: Build dists
6567
run: python -Im build
6668
- name: Verify that the artifacts with expected names got created

0 commit comments

Comments
 (0)