@@ -3,108 +3,94 @@ name: Build, validate & Release
33on :
44 push :
55 tags :
6- - ' v*.*.*'
6+ - " v*.*.*"
77 pull_request :
8- branches :
9- - main
10- - public
11- types :
12- - labeled
13- - opened
14- - edited
15- - synchronize
16- - reopened
8+ branches : [main, master]
9+ types : [opened, edited, synchronize, reopened]
10+
11+ permissions :
12+ contents : read
1713
1814jobs :
19- build_check :
20- name : Build & validate package
15+ test_matrix :
16+ name : Test install & smoke (Py ${{ matrix.python-version }})
2117 runs-on : ubuntu-latest
2218 strategy :
2319 fail-fast : false
2420 matrix :
25- python-version : [ "3.10", "3.11", "3.12" ] # adjust to what you support
21+ python-version : ["3.10", "3.11", "3.12"]
2622 steps :
27- - name : Checkout
28- uses : actions/checkout@v6
29-
30- - name : Setup Python ${{ matrix.python-version }}
31- uses : actions/setup-python@v6
23+ - uses : actions/checkout@v6
24+ - uses : actions/setup-python@v6
3225 with :
3326 python-version : ${{ matrix.python-version }}
34-
35- # If we use UV later, the lock file should be included here for caching and validation
36- - name : Cache pip
37- uses : actions/cache@v4
38- with :
39- path : ~/.cache/pip
40- key : ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'setup.cfg', 'setup.py', 'requirements.txt') }}
41- restore-keys : |
42- ${{ runner.os }}-pip-${{ matrix.python-version }}-
43- ${{ runner.os }}-pip-
27+ cache : pip
4428
4529 - name : Install build tools
46- run : |
47- python -m pip install --upgrade pip
48- python -m pip install build twine wheel "packaging>=24.2"
30+ run : python -m pip install -U pip build twine
4931
50- - name : Build distributions (sdist + wheel )
32+ - name : Build (for validation only )
5133 run : python -m build
5234
53- - name : Inspect dist
54- run : |
55- ls -lah dist/
56- echo "sdist contents (first ~200 entries):"
57- tar -tf dist/*.tar.gz | sed -n '1,200p'
58-
59- - name : Twine metadata & README check
35+ - name : Twine check
6036 run : python -m twine check dist/*
6137
6238 - name : Install from wheel & smoke test
6339 run : |
64- # Install from the built wheel (not from the source tree)
6540 python -m pip install dist/*.whl
66-
6741 python - <<'PY'
6842 import importlib
69- pkg_name = "dlclivegui" # change if your top-level import differs
70- m = importlib.import_module(pkg_name)
71- print("Imported:", m.__name__, "version:", getattr(m, "__version__", "n/a"))
43+ m = importlib.import_module("dlclivegui")
44+ print("Imported:", m.__name__)
7245 PY
7346
74- if ! command -v dlclivegui >/dev/null 2>&1; then
75- echo "CLI entry point 'dlclivegui' not found in PATH; skipping CLI smoke test."
76- else
77- echo "Running 'dlclivegui --help' smoke test..."
78- if ! dlclivegui --help >/dev/null 2>&1; then
79- echo "::error::'dlclivegui --help' failed; this indicates a problem with the installed CLI package."
80- exit 1
81- fi
82- fi
47+ build_release :
48+ name : Build release artifacts
49+ runs-on : ubuntu-latest
50+ needs : test_matrix
51+ if : startsWith(github.ref, 'refs/tags/v')
52+ steps :
53+ - uses : actions/checkout@v6
54+ - uses : actions/setup-python@v6
55+ with :
56+ python-version : " 3.12"
57+
58+ - name : Install build tools
59+ run : python -m pip install -U pip build twine
60+
61+ - name : Build distributions
62+ run : python -m build
63+
64+ - name : Twine check
65+ run : python -m twine check dist/*
66+
67+ - name : Upload dist artifacts
68+ uses : actions/upload-artifact@v4
69+ with :
70+ name : dist
71+ path : dist/*
8372
8473 publish :
85- name : Publish to PyPI
74+ name : Publish to PyPI (API token)
8675 runs-on : ubuntu-latest
87- needs : build_check
88- if : ${{ startsWith(github.ref, 'refs/tags/v') }} # only on tag pushes like v1.2.3
76+ needs : build_release
77+ if : startsWith(github.ref, 'refs/tags/v')
8978 steps :
90- - name : Checkout
91- uses : actions/checkout@v6
79+ - name : Download dist artifacts
80+ uses : actions/download-artifact@v4
81+ with :
82+ name : dist
83+ path : dist
9284
93- - name : Setup Python
94- uses : actions/setup-python@v6
85+ - uses : actions/setup-python@v6
9586 with :
9687 python-version : " 3.x"
9788
98- - name : Install build tools
99- run : |
100- python -m pip install --upgrade pip
101- python -m pip install build twine
102-
103- - name : Build distributions (sdist + wheel)
104- run : python -m build
89+ - name : Install Twine
90+ run : python -m pip install -U twine
10591
10692 - name : Publish to PyPI
10793 env :
10894 TWINE_USERNAME : __token__
10995 TWINE_PASSWORD : ${{ secrets.TWINE_API_KEY }}
110- run : python -m twine upload --verbose dist/*
96+ run : python -m twine upload --non-interactive -- verbose --skip-existing dist/*
0 commit comments