python-semantic-release: Github Action doesn't find Poetry

The problem

I am trying to use the semantic release GitHub Action. My build step is poetry build, and I am using snok/install-poetry@v1 (via packetcoders/action-setup-cache-python-poetry@main) to install Poetry. This fails with

🛠 Running build command: poetry build
bash: line 1: poetry: command not found

Presumably because semantic-release is running inside a Docker container without access to the previously installed Poetry.

As a side note, my builds are incredibly slow because the two semantic-release actions must be built from dockerfiles each time. Those two build steps take almost a minute each (compared to the cached install of Python and Poetry which takes only 10 seconds total).

Expected behavior

My project is built correctly.

Environment

Ubuntu github runner with Python 3.11 and Poetry 1.6.1, but those are probably not relevant due to containerization. The workflow looks like this:

      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: "Setup Python, Poetry and Dependencies"
        uses: packetcoders/action-setup-cache-python-poetry@main
        with:
          python-version: 3.11
          poetry-version: 1.6.1
      - name: Python Semantic Release
        id: release
        uses: python-semantic-release/python-semantic-release@v8.0.0
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          prerelease: "true"

      - name: Publish package distributions to GitHub Releases
        uses: python-semantic-release/upload-to-gh-release@main
        if: steps.release.outputs.released == 'true'
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}

Configuration

[build-system]
requires = [ "poetry-core" ]
build-backend = "poetry.core.masonry.api"

[tool.semantic_release]
version_toml = [ "pyproject.toml:tool.poetry.version" ]
build_command = "poetry build"
version_source = "tag"
commit_version_number = true
commit_message = "chore(release): v{version} [skip ci]"

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 16 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Hello @Yelinz 👋

This issue is still not fixed in the master branch. However, the specific tag v8.3.0 use the change in PR #692. Personally I use

    - uses: python-semantic-release/python-semantic-release@v8.3.0

to have access to the environment.

I am too lazy (for now) to make a script compatible for every gitlab-runner available and complete #741. To use the PSR master branch, the hack should still work, I think.