diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb57e4d..bc369d5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,6 +60,10 @@ jobs: release: runs-on: ubuntu-latest environment: release + + permissions: + id-token: write + if: github.ref == 'refs/heads/main' needs: - test @@ -67,18 +71,32 @@ jobs: - commitlint steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - # Run semantic release: - # - Update CHANGELOG.md - # - Update version in code - # - Create git tag - # - Create GitHub release - # - Publish to PyPI - name: Python Semantic Release + id: release uses: python-semantic-release/python-semantic-release@v9.8.1 with: github_token: ${{ secrets.GITHUB_TOKEN }} - pypi_token: ${{ secrets.PYPI_TOKEN }} + + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@v1 + if: steps.release.outputs.released == 'true' + + - name: Publish package to GitHub Release + uses: python-semantic-release/upload-to-gh-release@v9.8.1 + if: steps.release.outputs.released == 'true' + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@v1 + if: steps.release.outputs.released == 'true' + + - name: Publish package to GitHub Release + uses: python-semantic-release/upload-to-gh-release@v9.8.1 + if: steps.release.outputs.released == 'true' + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ steps.release.outputs.tag }}