Skip to content

Commit 121d878

Browse files
authored
Merge pull request #175 from hashicorp/ci-release
downgrade python to match local
2 parents af27fab + ba1a340 commit 121d878

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,18 @@ jobs:
9595
- name: Set up Python
9696
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c
9797
with:
98-
python-version: "3.12"
98+
python-version: "3.10"
9999

100100
- name: Verify tag matches pyproject.toml version
101101
env:
102102
TAG_INPUT: ${{ inputs.tag }}
103103
run: |
104104
set -euo pipefail
105-
py_ver=$(python -c "import tomllib, pathlib; print(tomllib.loads(pathlib.Path('pyproject.toml').read_bytes())['project']['version'])")
105+
# Parse [project].version with a regex anchored at column 0 so it
106+
# can't accidentally match `target-version` or `python_version`
107+
# entries further down. tomllib would be cleaner but isn't in
108+
# 3.10's stdlib, and pulling in tomli for one read isn't worth it.
109+
py_ver=$(python -c "import re,sys; m=re.search(r'(?m)^version\s*=\s*\"([^\"]+)\"', open('pyproject.toml').read()); sys.exit('version not found in pyproject.toml') if not m else print(m.group(1))")
106110
if [[ "$TAG_INPUT" != "v${py_ver}" && "$TAG_INPUT" != "$py_ver" ]]; then
107111
echo "::error::Tag '$TAG_INPUT' does not match pyproject.toml version '$py_ver' (expected 'v$py_ver' or '$py_ver')."
108112
exit 1
@@ -166,7 +170,7 @@ jobs:
166170

167171
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c
168172
with:
169-
python-version: "3.12"
173+
python-version: "3.10"
170174

171175
- name: Publish via bin/publish-pypi.sh
172176
env:

0 commit comments

Comments
 (0)