Skip to content

Commit 288b609

Browse files
committed
fix(ci): stop using hardcoded dependency versions
Use the versions defined in the pyproject.toml file
1 parent 7a77e37 commit 288b609

File tree

3 files changed

+41
-5
lines changed

3 files changed

+41
-5
lines changed

.github/workflows/bump_version_and_tag.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,25 @@ jobs:
4040

4141
- name: Install dependencies
4242
run: |
43-
python -m pip install 'pip==25.0.1'
44-
pip install 'packaging==24.0'
43+
export PIP_VERSION=$(grep -oP 'pip\s*==\s*\K([0-9]+\.[0-9]+\.[0-9]+)' pyproject.toml || echo '')
44+
if [ -z "$PIP_VERSION" ]; then
45+
echo '::warning title=Could not detect pip version::in pyproject.toml; falling back to latest.'
46+
PIP_INSTALL="pip"
47+
else
48+
echo "Will install pip version $PIP_VERSION."
49+
PIP_INSTALL="pip==$PIP_VERSION"
50+
fi
51+
python -m pip install "$PIP_INSTALL"
52+
53+
export PACKAGING_VERSION=$(grep -oP 'packaging\s*==\s*\K([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)' pyproject.toml || echo '')
54+
if [ -z "$PACKAGING_VERSION" ]; then
55+
echo '::warning title=Could not detect packaging version::in pyproject.toml; falling back to latest.'
56+
PACKAGING_INSTALL="packaging"
57+
else
58+
echo "Will install packaging version $PACKAGING_VERSION."
59+
PACKAGING_INSTALL="packaging==$PACKAGING_VERSION"
60+
fi
61+
pip install "$PACKAGING_INSTALL"
4562
4663
- name: Validate version format
4764
run: |

.github/workflows/i18n-extract.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,26 @@ jobs:
4848
4949
- name: Install python-gettext requirement
5050
run: |
51-
python -m pip install 'pip==25.0.1' 'python-gettext==5.0'
51+
export PIP_VERSION=$(grep -oP 'pip\s*==\s*\K([0-9]+\.[0-9]+\.[0-9]+)' pyproject.toml || echo '')
52+
export PYTHON_GETTEXT_VERSION=$(grep -oP 'python-gettext\s*==\s*\K([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)' pyproject.toml || echo '')
53+
54+
if [ -z "$PIP_VERSION" ]; then
55+
echo '::warning title=Could not detect pip version::in pyproject.toml; falling back to latest.'
56+
PIP_INSTALL="pip"
57+
else
58+
echo "Will install pip version $PIP_VERSION."
59+
PIP_INSTALL="pip==$PIP_VERSION"
60+
fi
61+
62+
if [ -z "$PYTHON_GETTEXT_VERSION" ]; then
63+
echo '::warning title=Could not detect python-gettext version::in pyproject.toml; falling back to 5.0.'
64+
PYTHON_GETTEXT_INSTALL="python-gettext==5.0"
65+
else
66+
echo "Will install python-gettext version $PYTHON_GETTEXT_VERSION."
67+
PYTHON_GETTEXT_INSTALL="python-gettext==$PYTHON_GETTEXT_VERSION"
68+
fi
69+
70+
python -m pip install "$PIP_INSTALL" "$PYTHON_GETTEXT_INSTALL"
5271
5372
- name: Extract strings
5473
run: |

.github/workflows/mypy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ jobs:
4040
export TYPES_REQUESTS_VERSION=$(grep -oP 'types-requests\s*==\s*\K([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)' pyproject.toml || echo '')
4141
4242
if [ -z "$MYPY_VERSION" ]; then
43-
echo "Could not detect mypy version in pyproject.toml; falling back to latest."
43+
echo '::warning title=Could not detect mypy version::in pyproject.toml; falling back to latest.'
4444
MYPY_INSTALL="mypy"
4545
else
4646
echo "Will install mypy version $MYPY_VERSION."
4747
MYPY_INSTALL="mypy==$MYPY_VERSION"
4848
fi
4949
5050
if [ -z "$TYPES_REQUESTS_VERSION" ]; then
51-
echo "Could not detect types-requests version in pyproject.toml; falling back to latest."
51+
echo '::warning title=Could not detect types-requests version::in pyproject.toml; falling back to latest.'
5252
TYPES_REQUESTS_INSTALL="types-requests"
5353
else
5454
echo "Will install types-requests version $TYPES_REQUESTS_VERSION."

0 commit comments

Comments
 (0)