Skip to content

Build and Release on PyPI #2

Build and Release on PyPI

Build and Release on PyPI #2

Workflow file for this run

name: Publish on PyPI
on:
pull_request:
types: [opened, synchronize, reopened]
release:
types: [created]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: pip
cache-dependency-path: |
**/setup.py
**/requirements*.txt
- name: Install dependencies
run: |
pip install -r requirements.txt -r requirements-dev.txt
- name: Build wheel
run: |
python setup.py sdist bdist_wheel
twine check dist/*
- name: Upload build for publishing
uses: actions/upload-artifact@v4
with:
name: parse_model_release
path: dist/*
pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-latest
needs: build
environment: release
permissions:
id-token: write
steps:
- name: Download math result for job 1
uses: actions/download-artifact@v4
with:
name: parse_model_release
path: dist
- name: Display structure of downloaded files
run: ls -R dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
with:
repository-url: https://test.pypi.org/legacy/
print-hash: true
verbose: true