@@ -5,42 +5,48 @@ inputs:
55 version :
66 description : GardenLinux Python library version
77 default : " 0.8.9"
8+ python_version :
9+ description : Python version to setup
10+ default : " 3.13"
811
912outputs :
1013 version :
14+ description : GardenLinux Python library version
15+ value : ${{ inputs.version }}
16+ python_version :
17+ description : Python version to setup
18+ value : ${{ inputs.python_version }}
19+ package_tool :
1120 description : " Detected Python cache strategy."
12- value : ${{ steps.env-check.outputs.cache_type }}
21+ value : ${{ steps.env-check.outputs.package_tool }}
1322
1423runs :
1524 using : composite
1625 steps :
17- - name : Verify requirements.txt for "actions/setup-python" with enabled "pip" cache
18- shell : bash
19- run : |
20- if [ ! -f "requirements.txt" ]; then
21- echo "gardenlinux @ git+https://github.com/gardenlinux/python-gardenlinux-lib.git@${{ inputs.version }}" | tee -a requirements.txt
22- fi
23-
24- - name : Evaluate Python Environment
26+ - name : Evaluate Python environment
2527 id : env-check
2628 shell : bash
2729 run : |
2830 # Determine cache type based on available lockfile
2931 if [ -f poetry.lock ]; then
30- echo "cache_type =poetry" >> $GITHUB_OUTPUT
32+ echo "package_tool =poetry" >> $GITHUB_OUTPUT
3133 elif [ -f requirements.txt ]; then
32- echo "cache_type =pip" >> $GITHUB_OUTPUT
34+ echo "package_tool =pip" >> $GITHUB_OUTPUT
3335 else
34- # no lockfile present: create empty requirements.txt and use pip caching
35- touch requirements.txt
36- echo "cache_type =pip" >> $GITHUB_OUTPUT
36+ # no lockfile present: create one and use pip caching
37+ echo "gardenlinux @ git+https://github.com/gardenlinux/python-gardenlinux-lib.git@${{ inputs.version }}" | tee -a requirements.txt
38+ echo "package_tool =pip" >> $GITHUB_OUTPUT
3739 fi
3840
39- - name : Set up Python 3.13
41+ - name : Install Poetry
42+ if : steps.env-check.outputs.package_tool == 'poetry'
43+ uses : snok/install-poetry@v1
44+
45+ - name : Set up Python ${{ inputs.python_version }}
4046 uses : actions/setup-python@v5
4147 with :
42- python-version : " 3.13 "
43- cache : ${{ steps.env-check.outputs.cache_type }}
48+ python-version : ${{ inputs.python_version }}
49+ cache : ${{ steps.env-check.outputs.package_tool }}
4450
4551 - name : Install GardenLinux Python library
4652 shell : bash
0 commit comments