File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,18 +3,19 @@ description: Installs project dependencies
33runs :
44 using : composite
55 steps :
6+ - name : Find latest Python supported by Red-DiscordBot
7+ id : find_pyver
8+ shell : bash
9+ run : |
10+ PYVER=$(bash "$GITHUB_WORKSPACE/.github/find_latest_red_pyver.sh")
11+ echo "python-version=$PYVER" >> "$GITHUB_OUTPUT"
612 - name : Set up Python
713 uses : actions/setup-python@v5
814 with :
9- python-version : " 3.11 "
15+ python-version : ${{ steps.find_pyver.outputs.python-version }}
1016 - name : Install base dependencies
1117 shell : bash
1218 run : pip install --quiet --upgrade --requirement requirements.txt
13- - name : Install CI dependencies
19+ - name : Install CI & cog dependencies
1420 shell : bash
1521 run : pip install --quiet --upgrade --requirement requirements-dev.txt
16- - name : Install cog dependencies
17- shell : bash
18- run : |
19- python3 .github/actions/setup/compile_requirements.py
20- pip install --quiet --upgrade --requirement requirements-cogs.txt
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -euo pipefail
3+
4+ PACKAGE=" Red-DiscordBot"
5+
6+ # Fetch requires_python string, e.g. ">=3.9,<3.13"
7+ REQUIRES=$( curl -s " https://pypi.org/pypi/${PACKAGE} /json" | jq -r ' .info.requires_python' )
8+
9+ # Extract lower and upper bounds
10+ LOWER=$( grep -oP ' (?<=\>=)[0-9]+\.[0-9]+' <<< " $REQUIRES" || true)
11+ UPPER=$( grep -oP ' (?<=\<)[0-9]+\.[0-9]+' <<< " $REQUIRES" | head -n1 || true)
12+
13+ # Get all active Python versions from endoflife.date API
14+ VERSIONS=$( curl -s https://endoflife.date/api/python.json | jq -r ' .[].latest' | cut -d. -f1,2 | sort -Vu)
15+
16+ # Filter by lower/upper bounds
17+ SUPPORTED=$( echo " $VERSIONS " | while read v; do
18+ if [[ -n " $LOWER " && " $( printf ' %s\n' " $v " " $LOWER " | sort -V | head -n1) " != " $LOWER " ]]; then
19+ continue
20+ fi
21+ if [[ -n " $UPPER " && " $( printf ' %s\n' " $v " " $UPPER " | sort -V | head -n1) " == " $UPPER " ]]; then
22+ continue
23+ fi
24+ echo " $v "
25+ done)
26+
27+ LATEST=$( echo " $SUPPORTED " | sort -V | tail -n1)
28+
29+ echo " $LATEST "
Original file line number Diff line number Diff line change @@ -23,10 +23,11 @@ jobs:
2323 - name : Checkout the repository at the current branch
2424 uses : actions/checkout@v4
2525 - name : Install dependencies
26+ id : setup_deps
2627 uses : ./.github/actions/setup
2728 - uses : jakebailey/pyright-action@v2
2829 with :
29- python-version : " 3.11 "
30+ python-version : ${{ steps.setup_deps.outputs.python-version }}
3031
3132 check-json :
3233 runs-on : ubuntu-latest
You can’t perform that action at this time.
0 commit comments