Skip to content

Commit b889599

Browse files
committed
fixing release workflow
1 parent 21fb3e9 commit b889599

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

.github/workflows/recorder-release.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,27 @@ jobs:
7373
shell: bash
7474
run: |
7575
PYTHON=$(command -v python3 || command -v python)
76-
VERSION=$("$PYTHON" -c "import importlib, pathlib; tomllib = importlib.import_module('tomllib'); data = tomllib.loads(pathlib.Path('codetracer-python-recorder/pyproject.toml').read_text()); print(data['project']['version'])")
76+
VERSION=$("$PYTHON" - <<'PY'
77+
from pathlib import Path
78+
79+
version = None
80+
in_project = False
81+
for line in Path("codetracer-python-recorder/pyproject.toml").read_text(encoding="utf-8").splitlines():
82+
stripped = line.strip()
83+
if stripped.startswith("["):
84+
in_project = stripped == "[project]"
85+
continue
86+
if in_project and stripped.startswith("version"):
87+
_, _, value = stripped.partition("=")
88+
version = value.strip().strip('"')
89+
break
90+
91+
if not version:
92+
raise SystemExit("Unable to find [project].version in pyproject.toml")
93+
94+
print(version)
95+
PY
96+
)
7797
echo "package_version=${VERSION}" >> "$GITHUB_OUTPUT"
7898
- name: Assert tag matches version
7999
if: startsWith(github.ref, 'refs/tags/')
@@ -92,7 +112,21 @@ jobs:
92112
command: build
93113
args: ${{ matrix.publish-args }}
94114
manylinux: ${{ matrix.manylinux }}
95-
before-script-linux: yum install -y capnproto
115+
before-script-linux: |
116+
set -eux
117+
if command -v yum >/dev/null 2>&1; then
118+
yum install -y capnproto
119+
elif command -v dnf >/dev/null 2>&1; then
120+
dnf install -y capnproto
121+
elif command -v microdnf >/dev/null 2>&1; then
122+
microdnf install -y capnproto
123+
elif command -v apt-get >/dev/null 2>&1; then
124+
apt-get update
125+
apt-get install -y capnproto
126+
else
127+
echo "Unable to install capnproto: no supported package manager found" >&2
128+
exit 1
129+
fi
96130
working-directory: codetracer-python-recorder
97131

98132
- name: Install Python 3.12 (macOS)

0 commit comments

Comments
 (0)