Skip to content

Merge pull request #42 from mattstibbs/main #9

Merge pull request #42 from mattstibbs/main

Merge pull request #42 from mattstibbs/main #9

Workflow file for this run

# .github/workflows/pypi-publish.yml
# This workflow will build the Python project, and publish it to pypi.org
name: Publish library to pypi.org on pushes to `main` branch
on:
push:
branches:
- main
jobs:
build:
name: Build the distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4 # latest as at Feb 2024
- uses: actions/setup-python@v5 # latest as at Feb 2024
with:
python-version: 3.11
- run: |
pip install poetry
poetry build
- uses: actions/upload-artifact@v4 # latest as at Feb 2024
with:
path: ./dist
# this is a separate job so that the build job does not have access to the PyPI token
pypi-test-publish:
needs: ['build']
environment: release
name: Upload from main branch to pypi.org
runs-on: ubuntu-latest
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Download package distributions from build job
uses: actions/download-artifact@v4 # latest as at Feb 2024
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1 # latest as at Feb 2024
with:
packages-dir: artifact