diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index e36731b..b10a6c6 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -9,10 +9,10 @@ jobs: build-and-publish: name: Build and publish Python package to PyPI runs-on: ubuntu-latest - # NOTE: You should create a "pypi-publish" environment in GitHub repo settings + # NOTE: You should create an environment in GitHub repo settings # and configure it to match what you set up in PyPI trusted publishing # Uncomment the following line once your environment is set up in GitHub: - # environment: pypi-publish + environment: pypi permissions: id-token: write # Required for trusted publishing (OIDC) contents: read # To checkout the repository @@ -33,8 +33,14 @@ jobs: python -m pip install --upgrade pip python -m pip install build twine + - name: Extract version from tag + id: get_version + run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT + - name: Build package working-directory: ./pysmq + env: + SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYSMQ: ${{ steps.get_version.outputs.VERSION }} run: python -m build - name: Publish package to PyPI