Skip to content

Commit 62f7d4c

Browse files
Output the package name (#162)
* Output the package name * Raise exception if package name is not found * Echo structlog package name --------- Co-authored-by: Hynek Schlawack <[email protected]>
1 parent 8fe98a6 commit 62f7d4c

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ jobs:
6060
path: structlog
6161
upload-name-suffix: "-structlog-${{ matrix.os }}"
6262

63-
- run: echo Packages can be found at ${{ steps.baipp.outputs.dist }} and in artifact ${{ steps.baipp.outputs.artifact-name }}
63+
- run: >
64+
echo "Packages for ${{ steps.baipp.outputs.package_name }} (${{ steps.baipp.outputs.package_version }})
65+
can be found at ${{ steps.baipp.outputs.dist }}
66+
and in artifact ${{ steps.baipp.outputs.artifact-name }}"
6467
6568
check-pytest:
6669
name: Build & verify the pytest package.

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ While *build-and-inspect-python-package* will build a wheel for you by default,
161161

162162
This is useful if you only want to define a matrix based on Python versions, because then you can just assign this to `strategy.matrix`.
163163

164+
- `package_name`: The name of the package as extracted from the package metadata.
165+
164166
- `package_version`: The version of the package as extracted from the package metadata.
165167

166168
This is useful, for example, for displaying the PyPI URL on the GitHub UI for the publishing job:
@@ -173,7 +175,7 @@ While *build-and-inspect-python-package* will build a wheel for you by default,
173175
needs: baipp
174176
environment:
175177
name: pypi
176-
url: https://pypi.org/project/structlog/${{ needs.baipp.outputs.package-version }}
178+
url: https://pypi.org/project/${{ needs.baipp.outputs.package-name }}/${{ needs.baipp.outputs.package-version }}
177179
```
178180

179181
### Artifacts

action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ outputs:
4444
supported Python versions. In other words, you can assign it directly to
4545
the 'strategy.matrix' key.
4646
value: ${{ steps.metadata-setter.outputs.supported_python_classifiers_json_job_matrix_value }}
47+
package_name:
48+
description: The name of the package.
49+
value: ${{ steps.metadata-setter.outputs.package_name }}
4750
package_version:
4851
description: The version of the package as declared in the metadata.
4952
value: ${{ steps.metadata-setter.outputs.package_version }}
@@ -251,8 +254,13 @@ runs:
251254
if match := re.match(r"Programming Language :: Python :: (\d+\.\d+)$", classifier):
252255
version_tokens.append(match.group(1))
253256
257+
package_name = pkg_info.get("Name")
258+
if package_name is None:
259+
raise RuntimeError("Package name is not set")
260+
254261
package_version = pkg_info.get("Version", "0.0.0")
255262
263+
print(f"package_name={package_name}")
256264
print(f"package_version={package_version}")
257265
print(f"supported_python_classifiers_json_array={json.dumps(version_tokens)}")
258266
print(f"""supported_python_classifiers_json_job_matrix_value={json.dumps({"python-version": version_tokens})}""")

0 commit comments

Comments
 (0)