-
Notifications
You must be signed in to change notification settings - Fork 24
69 lines (58 loc) · 1.96 KB
/
main.yml
File metadata and controls
69 lines (58 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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/gh-action-pypi-publish@v1.4.2
with:
user: __token__
password: ${{ secrets.pypi_password }}
skip_existing: true