v0.1.0 #2
Workflow file for this run
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 Python Package | |
| # Publishes with trusted publishing to | |
| # - PyPI on releases created in GitHub UI if status is published. | |
| # For draft status, nothing happens. | |
| # - TestPyPI on new tags "v1.2.3" or "v1.2.3.something" on main branch | |
| # | |
| # More on trusted publishing: https://docs.pypi.org/trusted-publishers/ | |
| on: # yamllint disable-line rule:truthy | |
| push: | |
| tags: | |
| # GitHub glob matching is limited [1]. So we can't define a pattern matching | |
| # pep 440 version definition [N!]N(.N)*[{a|b|rc}N][.postN][.devN] | |
| - 'v[0-9]+.[0-9]+.[0-9]+.?*' | |
| - 'v[0-9]+.[0-9]+.[0-9]+rc[0-9]' | |
| release: | |
| types: [published] | |
| permissions: {} | |
| jobs: | |
| build: | |
| name: Build Python π distributions π¦ for publishing | |
| runs-on: ubuntu-latest | |
| steps: | |
| # https://github.com/actions/checkout | |
| - name: Check out repository | |
| uses: actions/checkout@v4.2.2 | |
| with: | |
| persist-credentials: false | |
| # https://github.com/astral-sh/setup-uv | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6.4.3 | |
| with: | |
| python-version: 3.13 | |
| enable-cache: true | |
| # https://github.com/actions/setup-python | |
| - name: Set up Python | |
| uses: actions/setup-python@v5.6.0 | |
| with: | |
| python-version: 3.13 | |
| - name: Install just | |
| run: | | |
| uv tool install rust-just | |
| - name: Build source and wheel archives | |
| run: uv build | |
| # https://github.com/actions/upload-artifact | |
| - name: Store built distribution | |
| uses: actions/upload-artifact@v4.6.2 | |
| with: | |
| name: distribution-files | |
| path: dist/ | |
| pypi-publish: | |
| name: Build and publish Python π package π¦ to PyPI and TestPyPI | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi-release | |
| url: https://pypi.org/p/dismech | |
| permissions: | |
| id-token: write # this permission is mandatory for trusted publishing | |
| steps: | |
| # https://github.com/actions/download-artifact | |
| - name: Download built distribution | |
| uses: actions/download-artifact@v4.3.0 | |
| with: | |
| name: distribution-files | |
| path: dist | |
| # https://github.com/pypa/gh-action-pypi-publish | |
| - name: Publish package π¦ to Test PyPI | |
| if: github.event_name == 'push' | |
| uses: pypa/gh-action-pypi-publish@v1.12.4 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| verbose: true | |
| - name: Publish package π¦ to PyPI | |
| if: github.event_name == 'release' | |
| uses: pypa/gh-action-pypi-publish@v1.12.4 | |
| with: | |
| verbose: true | |
| # [1] https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet | |
| # Used actions: (updates managed by dependabot) | |
| # - https://github.com/actions/checkout | |
| # - https://github.com/astral-sh/setup-uv | |
| # - https://github.com/actions/setup-python | |
| # - https://github.com/actions/upload-artifact | |
| # - https://github.com/actions/download-artifact | |
| # - https://github.com/pypa/gh-action-pypi-publish/ |