@@ -2,22 +2,26 @@ name: Build, validate & Release
22
33on :
44 push :
5- tags : [ 'v*.*.*' ]
5+ tags :
6+ - ' v*.*.*'
67 pull_request :
78 branches : [ main, master ]
89 types : [ labeled, opened, edited, synchronize, reopened ]
910
1011jobs :
11- test :
12- name : Test / smoke (matrix)
12+ build_check :
13+ name : Build & validate package
1314 runs-on : ubuntu-latest
1415 strategy :
1516 fail-fast : false
1617 matrix :
17- python-version : [ "3.10", "3.11", "3.12" ]
18+ python-version : [ "3.10", "3.11", "3.12" ] # adjust to what you support
1819 steps :
19- - uses : actions/checkout@v6
20- - uses : actions/setup-python@v6
20+ - name : Checkout
21+ uses : actions/checkout@v6
22+
23+ - name : Setup Python ${{ matrix.python-version }}
24+ uses : actions/setup-python@v6
2125 with :
2226 python-version : ${{ matrix.python-version }}
2327
@@ -50,63 +54,50 @@ jobs:
5054
5155 - name : Install from wheel & smoke test
5256 run : |
57+ # Install from the built wheel (not from the source tree)
5358 python -m pip install dist/*.whl
59+
5460 python - <<'PY'
5561 import importlib
56- pkg_name = "dlclivegui"
62+ pkg_name = "dlclivegui" # change if your top-level import differs
5763 m = importlib.import_module(pkg_name)
5864 print("Imported:", m.__name__, "version:", getattr(m, "__version__", "n/a"))
5965 PY
6066
6167 if ! command -v dlclivegui >/dev/null 2>&1; then
62- echo "CLI entry point 'dlclivegui' not found in PATH; skipping CLI smoke test."
68+ echo "CLI entry point 'dlclivegui' not found in PATH; skipping CLI smoke test."
6369 else
64- if command -v dlclivegui >/dev/null 2>&1; then
6570 echo "Running 'dlclivegui --help' smoke test..."
6671 if ! dlclivegui --help >/dev/null 2>&1; then
6772 echo "::error::'dlclivegui --help' failed; this indicates a problem with the installed CLI package."
6873 exit 1
6974 fi
75+ fi
7076
71- build :
72- name : Build release artifacts (single)
77+ publish :
78+ name : Publish to PyPI
7379 runs-on : ubuntu-latest
74- needs : test
75- if : ${{ startsWith(github.ref, 'refs/tags/v') }}
80+ needs : build_check
81+ if : ${{ startsWith(github.ref, 'refs/tags/v') }} # only on tag pushes like v1.2.3
7682 steps :
77- - uses : actions/checkout@v6
78- - uses : actions/setup-python@v6
83+ - name : Checkout
84+ uses : actions/checkout@v6
85+
86+ - name : Setup Python
87+ uses : actions/setup-python@v6
7988 with :
80- python-version : " 3.12 "
89+ python-version : " 3.x "
8190
82- - name : Build distributions (sdist + wheel)
91+ - name : Install build tools
8392 run : |
8493 python -m pip install --upgrade pip
85- python -m pip install build twine wheel "packaging>=24.2"
86- python -m build
87- python -m twine check dist/*
88-
89- - name : Upload dist artifacts
90- uses : actions/upload-artifact@v4
91- with :
92- name : dist
93- path : dist/*
94- if-no-files-found : error
94+ python -m pip install build twine
9595
96- publish :
97- name : Publish to PyPI (OIDC)
98- runs-on : ubuntu-latest
99- needs : build
100- if : ${{ startsWith(github.ref, 'refs/tags/v') }}
101- environment : pypi
102- permissions :
103- id-token : write
104- steps :
105- - name : Download dist artifacts
106- uses : actions/download-artifact@v4
107- with :
108- name : dist
109- path : dist
96+ - name : Build distributions (sdist + wheel)
97+ run : python -m build
11098
11199 - name : Publish to PyPI
112- uses : pypa/gh-action-pypi-publish@release/v1
100+ env :
101+ TWINE_USERNAME : __token__
102+ TWINE_PASSWORD : ${{ secrets.TWINE_API_KEY }}
103+ run : python -m twine upload --verbose dist/*
0 commit comments