-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction.yml
54 lines (42 loc) · 1.21 KB
/
action.yml
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
name: 'install_python_packages'
description: 'Install generic and required python packages with pip'
inputs:
packages:
description: 'Custom packages to install using pip'
required: false
default: ''
upgrade:
description: 'Upgrade already installed packages'
required: false
default: false
requirements_file_name:
description: 'If set, the file name of a requirements.txt file'
required: false
default: ''
runs:
using: composite
steps:
- name: install_python_packages
run: |
echo "::group::Install Python packages"
# Set upgrade flag
if [[ "${{ inputs.upgrade }}" == "true" ]]
then
export UPGRADE_FLAG="--upgrade"
else
export UPGRADE_FLAG=""
fi
# Install python packages if any
if [[ ! -z "${{ inputs.packages }}" ]]
then
pip3 install ${UPGRADE_FLAG} \
${{ inputs.packages }}
fi
# Install requirements file if any
if [[ ! -z "${{ inputs.requirements_file_name }}" ]]
then
pip3 install ${UPGRADE_FLAG} \
-r ${{ inputs.requirements_file_name }}
fi
echo "::endgroup::"
shell: bash