semantic-release icon indicating copy to clipboard operation
semantic-release copied to clipboard

Add python support

Open shaunc opened this issue 3 years ago • 2 comments

I'm wondering if I can use this for a python project on gitlab.

I like this project because of how lightweight it is, supports gitlab, and support pre-releases, which the current python-semantic-release doesn't (among a few other glitches I had using it). I've used the original semantic-release before, but AFAIK I'd have to use yarn/npm tooling in addition to poetry, which seems unnecessary if I can avoid it.

I suppose I would need to add pyproject.toml version support. The doc doesn't say anything about adding custom plugins. Does the .semrelrc support them? Any other thoughts?

shaunc avatar Feb 09 '22 23:02 shaunc

Hi @shaunc, at the moment we only have support for npm packages and helm charts. I am happy to add support for poetry. You can enable plugins using command line flags or the .semrelrc config file.

christophwitzko avatar Feb 10 '22 08:02 christophwitzko

I wanted to share that I was able leverage this GitHub action + Poetry using what is already available. Here is what I have:

      - uses: actions/checkout@v3
      - uses: abatilo/actions-poetry@v2

      # Perform a Release (note the id being assigned below) 
      - name: Release
        id: release
        uses: go-semantic-release/action@v1
        if: github.ref == 'refs/heads/main'
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          allow-initial-development-versions: true
      
      # Bump Poetry Version with the output from the release step
      - name: Bump Poetry
        if: github.ref == 'refs/heads/main' && steps.release.outputs.version != ''
        run: poetry version ${{ steps.release.outputs.version }}
      
      # Commit the version bump back to main branch
      - uses: EndBug/add-and-commit@v9
        if: github.ref == 'refs/heads/main' && steps.release.outputs.version != ''
        with:
          message: "chore(version): bump"
          default_author: github_actions
          add: pyproject.toml

You can then ofcourse do a poetry publish if you need. Hope this helps!

kiran94 avatar May 21 '23 08:05 kiran94