Skip to content

Commit 71f309d

Browse files
committed
Update create-virtualenv action with uv support
1 parent 37d464f commit 71f309d

1 file changed

Lines changed: 19 additions & 6 deletions

File tree

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
---
22
name: create virtualenv
3-
description: create virtualenv using input name
3+
description: create virtualenv using input name in the default working directory
44

55
inputs:
66
venv:
77
description: name of virtualenv
88
required: true
9+
use_uv:
10+
description: if 'true', use uv if available (falls back to virtualenv if not) (default='true')
11+
required: false
12+
default: 'true'
913

1014
outputs:
1115
penv:
@@ -16,10 +20,19 @@ runs:
1620
using: composite
1721
steps:
1822
- id: env
23+
env:
24+
USE_UV: ${{ inputs.us_uv }}
25+
VENV_NAME: ${{ inputs.venv }}
1926
run: |
20-
# install virtualenv
21-
python -m pip install virtualenv
22-
python -m virtualenv ${{ inputs.venv }}
23-
pwd; ls -al
24-
echo "penv=$(pwd)/${{ inputs.venv }}" >> "$GITHUB_OUTPUT"
27+
if [[ ${USE_UV} == 'true' ]] && command -v uv; then
28+
uv venv "${VENV_NAME}"
29+
else
30+
python -m pip install virtualenv
31+
python -m virtualenv "${VENV_NAME}"
32+
fi
33+
34+
echo "::group::$(pwd) contents:"
35+
ls -Al
36+
echo "::endgroup::"
37+
echo "penv=$(pwd)/${VENV_NAME}" >> "${GITHUB_OUTPUT}"
2538
shell: bash

0 commit comments

Comments
 (0)