Skip to content

Build and Publish Python Package #1

Build and Publish Python Package

Build and Publish Python Package #1

name: Build and Publish Python Package
on:
release:
types: [created]
workflow_dispatch: # Allow manual triggering
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build wheel setuptools twine
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Build package
run: |
python -m build
python setup.py sdist bdist_wheel
- name: List built distributions
run: ls -l dist/
- name: Store wheel artifact
uses: actions/upload-artifact@v3
with:
name: wheel-package
path: dist/*.whl
# The wheel will have the naming format: ttnn_trace_viewer-version-py3-none-any.whl
- name: Upload Release Asset
if: github.event_name == 'release'
uses: softprops/action-gh-release@v1
with:
files: dist/*.whl
- name: Publish to PyPI
if: github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
skip_existing: true