File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -13,11 +13,32 @@ runs:
1313 if [ ! -f "requirements.txt" ]; then
1414 echo "python-gardenlinux-lib @ git+https://github.com/gardenlinux/python-gardenlinux-lib.git@${{ inputs.version }}" | tee -a requirements.txt
1515 fi
16+ - name : Check for Python
17+ id : python-check
18+ run : |
19+ if command -v python &/dev/null; then
20+ echo "python_installed=true" >> $GITHUB_OUTPUT
21+ else
22+ echo "python_installed=false" >> $GITHUB_OUTPUT
23+ fi
24+ - name : Activate caching based on lockfile
25+ id : lockfile
26+ run : |
27+ if [ -f poetry.lock ]; then
28+ echo "cache_type=poetry" >> $GITHUB_OUTPUT
29+ elif [ -f requirements.txt ]; then
30+ echo "cache_type=pip" >> $GITHUB_OUTPUT
31+ else
32+ # no lockfile present: create empty requirements.txt and use pip caching
33+ touch requirements.txt
34+ echo "cache_type=pip" >> $GITHUB_OUTPUT
35+ fi
1636 - name : Set up Python 3.13
37+ if : steps.python-check.outputs.python_installed == 'false'
1738 uses : actions/setup-python@v5
1839 with :
1940 python-version : " 3.13"
20- cache : ' pip '
41+ cache : ${{ steps.lockfile.outputs.cache_type }}
2142 - name : Install GardenLinux Python library
2243 shell : bash
2344 run : |
You can’t perform that action at this time.
0 commit comments