diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 572a808..215071c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,7 +60,10 @@ jobs: path: structlog upload-name-suffix: "-structlog-${{ matrix.os }}" - - run: echo Packages can be found at ${{ steps.baipp.outputs.dist }} and in artifact ${{ steps.baipp.outputs.artifact-name }} + - run: > + echo "Packages for ${{ steps.baipp.outputs.package_name }} (${{ steps.baipp.outputs.package_version }}) + can be found at ${{ steps.baipp.outputs.dist }} + and in artifact ${{ steps.baipp.outputs.artifact-name }}" check-pytest: name: Build & verify the pytest package. diff --git a/README.md b/README.md index 6cda6bd..b908a71 100644 --- a/README.md +++ b/README.md @@ -161,6 +161,8 @@ While *build-and-inspect-python-package* will build a wheel for you by default, 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`. +- `package_name`: The name of the package as extracted from the package metadata. + - `package_version`: The version of the package as extracted from the package metadata. 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, needs: baipp environment: name: pypi - url: https://pypi.org/project/structlog/${{ needs.baipp.outputs.package-version }} + url: https://pypi.org/project/${{ needs.baipp.outputs.package-name }}/${{ needs.baipp.outputs.package-version }} ``` ### Artifacts diff --git a/action.yml b/action.yml index e0f6f74..0b02525 100644 --- a/action.yml +++ b/action.yml @@ -44,6 +44,9 @@ outputs: supported Python versions. In other words, you can assign it directly to the 'strategy.matrix' key. value: ${{ steps.metadata-setter.outputs.supported_python_classifiers_json_job_matrix_value }} + package_name: + description: The name of the package. + value: ${{ steps.metadata-setter.outputs.package_name }} package_version: description: The version of the package as declared in the metadata. value: ${{ steps.metadata-setter.outputs.package_version }} @@ -251,8 +254,13 @@ runs: if match := re.match(r"Programming Language :: Python :: (\d+\.\d+)$", classifier): version_tokens.append(match.group(1)) + package_name = pkg_info.get("Name") + if package_name is None: + raise RuntimeError("Package name is not set") + package_version = pkg_info.get("Version", "0.0.0") + print(f"package_name={package_name}") print(f"package_version={package_version}") print(f"supported_python_classifiers_json_array={json.dumps(version_tokens)}") print(f"""supported_python_classifiers_json_job_matrix_value={json.dumps({"python-version": version_tokens})}""")