Skip to content

Commit a6fe934

Browse files
committed
style(ci): Prettier normalize & poetry-friendly version check
1 parent bb1bd5e commit a6fe934

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

.github/workflows/publish-pypi.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
name: publish-pypi
2-
32
on:
43
workflow_dispatch:
54
push:
6-
tags:
7-
- "v*"
8-
5+
tags: ["v*"]
96
permissions:
107
contents: read
118
id-token: write
12-
139
jobs:
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)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "ci-matrix-starter"
3-
version = "0.1.0"
3+
version = "0.1.4"
44
description = "Reusable CI workflows for Py/TS with SBOM & signatures."
55
authors = ["CoderDeltaLAN <coderdeltalan.cargo784@8alias.com>"]
66
readme = "README.md"

0 commit comments

Comments
 (0)