Publish Python π distributions π¦ to PyPI #1
This file contains 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 π distributions π¦ to PyPI | |
on: | |
release: # Trigger when a new release is made. | |
types: [published] | |
workflow_dispatch: # Trigger manually. | |
jobs: | |
build: | |
name: Build Python π distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install poetry | |
run: pipx install poetry==1.8.3 | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Install dependencies | |
run: poetry install -E ert --no-interaction | |
- name: Build wheel | |
run: poetry build | |
- name: Store the distribution packages | |
uses: actions/upload-artifact@v4 | |
with: | |
name: completor-package-dist | |
path: dist/ | |
publish-to-pypi: | |
name: >- | |
Publish Python π distribution π¦ to PyPI | |
if: startsWith(github.ref, 'refs/tags/') # Only publish to PyPI on tag pushes. | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/completor | |
permissions: | |
id-token: write # IMPORTANT: Mandatory for trusted publishing. | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@v4 | |
with: | |
name: completor-package-dist | |
path: dist/ | |
- name: Publish distribution π¦ to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |