diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml index b2cb0e1..5cea90d 100644 --- a/.github/workflows/publish_release.yml +++ b/.github/workflows/publish_release.yml @@ -9,14 +9,33 @@ jobs: release: runs-on: ubuntu-latest concurrency: release + permissions: + id-token: write + contents: write steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 + # This action uses Python Semantic Release v8 - name: Python Semantic Release - uses: relekang/python-semantic-release@master + id: release + uses: python-semantic-release/python-semantic-release@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_TOKEN }} + # NOTE: DO NOT wrap the conditional in ${{ }} as it will always evaluate to true. + # See https://github.com/actions/runner/issues/1173 + if: steps.release.outputs.released == '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 }} - pypi_token: ${{ secrets.PYPI_TOKEN }} \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 07de284..c56acbf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,11 @@ [build-system] requires = ["setuptools", "wheel"] -build-backend = "setuptools.build_meta" \ No newline at end of file +build-backend = "setuptools.build_meta" + +[tool.semantic_release] +version_variables = [ + "tgeraser/__version__.py:VERSION", +] + +[tool.semantic_release.publish] +dist_glob_patterns = ["*"] diff --git a/setup.cfg b/setup.cfg index cfcd09b..1c7e14a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -36,6 +36,3 @@ exclude = tests [options.entry_points] console_scripts = tgeraser = tgeraser.core:entry - -[semantic_release] -version_variable = tgeraser/__version__.py:VERSION