File tree Expand file tree Collapse file tree 2 files changed +12
-9
lines changed
Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change 11name : publish-pypi
2-
32on :
43 workflow_dispatch :
54 push :
6- tags :
7- - " v*"
8-
5+ tags : ["v*"]
96permissions :
107 contents : read
118 id-token : write
12-
139jobs :
1410 build-publish :
1511 name : Build & publish to PyPI
1612 runs-on : ubuntu-latest
1713 environment : pypi
1814 steps :
1915 - uses : actions/checkout@v4
16+ with :
17+ fetch-tags : true
2018
2119 - uses : actions/setup-python@v5
2220 with :
@@ -34,12 +32,17 @@ jobs:
3432 shell : bash
3533 run : |
3634 PYPROJECT_VERSION=$(python - <<'PY'
37- import tomllib
38- print(tomllib.load(open("pyproject.toml","rb"))["project"]["version"])
35+ import tomllib, sys
36+ d = tomllib.load(open("pyproject.toml","rb"))
37+ v = (d.get("project") or {}).get("version") \
38+ or (d.get("tool", {}).get("poetry") or {}).get("version")
39+ if not v:
40+ sys.exit(2)
41+ print(v)
3942 PY
4043 )
4144 TAG="${GITHUB_REF_NAME#v}"
42- echo "pyproject.toml : $PYPROJECT_VERSION / tag: $TAG"
45+ echo "pyproject/poetry : $PYPROJECT_VERSION / tag: $TAG"
4346 test "$TAG" = "$PYPROJECT_VERSION"
4447
4548 - name : Publish to PyPI (Trusted Publisher)
Original file line number Diff line number Diff line change 11[tool .poetry ]
22name = " ci-matrix-starter"
3- version = " 0.1.0 "
3+ version = " 0.1.4 "
44description = " Reusable CI workflows for Py/TS with SBOM & signatures."
55authors = [" CoderDeltaLAN <coderdeltalan.cargo784@8alias.com>" ]
66readme = " README.md"
You can’t perform that action at this time.
0 commit comments