Skip to content

Update

Update #249

Workflow file for this run

name: Build and upload to PyPI
on: [push, pull_request]
jobs:
build:
name: Build sdist + wheel (pure Python)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.x
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: pip
- name: Run test.py
run: |
python -m pip install opencv-python dynamsoft-capture-vision-bundle
python test.py
- name: Install build tooling
run: |
python -m pip install -U pip build twine
- name: Build distributions
run: |
python -m build # creates dist/*.whl and dist/*.tar.gz
- name: Check metadata
run: |
python -m twine check dist/*
- name: Ensure universal wheel for pure Python
shell: bash
run: |
set -e
WHEEL="$(ls dist/*.whl | head -n1)"
echo "Built wheel: $WHEEL"
# Expect *-py3-none-any.whl for pure-Python universal wheels
if [[ "$WHEEL" != *"-py3-none-any.whl" ]]; then
echo "::warning::Wheel is not tagged 'py3-none-any'. Verify package is pure Python or build config."
fi
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/*
upload_pypi:
needs: build
runs-on: ubuntu-latest
# upload to PyPI on every tag starting with 'v'
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
# alternatively, to publish when a GitHub Release is created, use the following rule:
# if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist
- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.pypi_password }}
skip_existing: true