Publish and Release #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish and Release | |
| # A github reusable workflow to: | |
| # - Run code checks and tests on multiple python versions and platforms; | |
| # - Publish a python package to test.pypi.org and pypi.org; and | |
| # - Create a GitHub Release. | |
| # | |
| # The workflow is triggered on: | |
| # - push to version tags matching "v*", eg. "v1.0.0", or | |
| # - manual workflow_dispatch (eg. from the github `Actions` tab): | |
| # - will produce a release with a version tag like: "v1.0.1.devN" | |
| # | |
| # Uses reusable workflows from the <https://github.com/glenn20/python-ci> | |
| # repository. | |
| on: | |
| push: | |
| tags: ["v*"] # Publish on tags matching "v*", eg. "v1.0.0" | |
| workflow_dispatch: | |
| jobs: | |
| tests: | |
| name: Tests | |
| uses: glenn20/python-ci/.github/workflows/check-test-build.yaml@main | |
| with: | |
| os: '["ubuntu-latest", "windows-latest", "macos-latest"]' | |
| python-version: '["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]' | |
| publish-test: | |
| name: Publish to test.pypi | |
| uses: ./.github/workflows/publish.yaml | |
| needs: tests | |
| with: | |
| pypi: test.pypi | |
| permissions: | |
| id-token: write # IMPORTANT: mandatory for trusted publishing! | |
| publish-pypi: | |
| name: Publish to pypi | |
| uses: ./.github/workflows/publish.yaml | |
| needs: tests | |
| with: | |
| pypi: upload.pypi | |
| permissions: | |
| id-token: write # IMPORTANT: mandatory for trusted publishing! | |
| github-release: | |
| name: Create GitHub release | |
| uses: glenn20/python-ci/.github/workflows/release.yaml@v1 | |
| needs: tests | |
| permissions: | |
| contents: write # IMPORTANT: mandatory for github release | |
| id-token: write # IMPORTANT: mandatory for github release |