Skip to content

Build and Publish Python Package #3

Build and Publish Python Package

Build and Publish Python Package #3

Workflow file for this run

name: Build and Publish Python Package
on:
release:
types: [created]
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: '**/pyproject.toml'
- name: Install dependencies
run: |
pip install -e 'src/python[core,test]'
- name: Run tests
working-directory: src/python
run: |
python -m unittest discover tests
deploy:
runs-on: ubuntu-latest
needs: [test]
environment: pypi
permissions:
id-token: write
if: |
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'release' &&
startsWith(github.ref, 'refs/tags/') &&
contains(github.ref, 'py_v'))
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: pip
cache-dependency-path: '**/pyproject.toml'
- name: Install dependencies
run: |
pip install setuptools wheel build
- name: Build
working-directory: src/python
run: |
python -m build
- name: Publish
working-directory: src/python
uses: pypa/gh-action-pypi-publish@release/v1

Check failure on line 65 in .github/workflows/pypi_publish.yml

View workflow run for this annotation

GitHub Actions / Build and Publish Python Package

Invalid workflow file

The workflow is not valid. .github/workflows/pypi_publish.yml (Line: 65, Col: 9): Unexpected value 'uses' .github/workflows/pypi_publish.yml (Line: 63, Col: 9): Required property is missing: run