-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaction.yml
More file actions
56 lines (51 loc) · 1.93 KB
/
action.yml
File metadata and controls
56 lines (51 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: python_lib
description: Installs the given GardenLinux Python library
inputs:
version:
description: GardenLinux Python library version
default: "0.10.20"
python_version:
description: Python version to setup
default: "3.13"
outputs:
version:
description: GardenLinux Python library version
value: ${{ inputs.version }}
python_version:
description: Python version to setup
value: ${{ inputs.python_version }}
package_tool:
description: "Detected Python cache strategy."
value: ${{ steps.env-check.outputs.package_tool }}
runs:
using: composite
steps:
- name: Evaluate Python environment
id: env-check
shell: bash
run: |
# Determine cache type based on available lockfile
if [ -f poetry.lock ]; then
echo "package_tool=poetry" >> $GITHUB_OUTPUT
elif [ -f requirements.txt ]; then
echo "package_tool=pip" >> $GITHUB_OUTPUT
else
# no lockfile present: create one and use pip caching
echo "gardenlinux @ git+https://github.com/gardenlinux/python-gardenlinux-lib.git@${{ inputs.version }}" | tee -a requirements.txt
echo "package_tool=pip" >> $GITHUB_OUTPUT
fi
- name: Install Poetry
if: steps.env-check.outputs.package_tool == 'poetry'
uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1
- name: Set up Python ${{ inputs.python_version }}
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: ${{ inputs.python_version }}
cache: ${{ steps.env-check.outputs.package_tool }}
cache-dependency-path: |
${{ github.workspace }}/poetry.lock
${{ github.workspace }}/requirements.txt
- name: Install GardenLinux Python library
shell: bash
run: |
pip install git+https://github.com/gardenlinux/python-gardenlinux-lib.git@${{ inputs.version }}