Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 18 additions & 13 deletions setup-python/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,23 @@ runs:
if: runner.arch == 'ARM64' || inputs.force-pyenv != 'false'
shell: sh
run: |
export PYENV_ROOT="$HOME/.pyenv"
echo "PYENV_ROOT=$HOME/.pyenv" >> $GITHUB_ENV

if [ ! -d "$PYENV_ROOT" ]; then
echo " ==== installing pyenv at: $PYENV_ROOT"
curl https://pyenv.run | bash
else
echo " ==== pyenv directory found at: $PYENV_ROOT"
env | sort

if [ -z "${PYENV_ROOT+x}" ]; then
export PYENV_ROOT="$HOME/.pyenv"
echo "PYENV_ROOT=$HOME/.pyenv" >> $GITHUB_ENV

if [ ! -d "$PYENV_ROOT" ]; then
echo " ==== installing pyenv at: $PYENV_ROOT"
curl https://pyenv.run | bash
else
echo " ==== pyenv directory found at: $PYENV_ROOT"
fi

export PATH="$PYENV_ROOT/bin:$PATH"
echo "PATH=$PYENV_ROOT/bin:$PATH" >> $GITHUB_ENV
fi

export PATH="$PYENV_ROOT/bin:$PATH"
echo "PATH=$PYENV_ROOT/bin:$PATH" >> $GITHUB_ENV

# Ensure pyenv is up to date

if ! (pyenv -h > /dev/null 2> /dev/null); then
echo " ==== pyenv -h exited with non-zero status"
type pyenv || true
Expand All @@ -105,6 +108,8 @@ runs:
ls -l "$PYENV_ROOT/bin" || true
exit 1
fi

# Ensure pyenv is up to date
pyenv update

FULL_PY_VERSION=$(pyenv install --list | grep "^ ${{ inputs.python-version }}" | grep -v 'dev' | tail -n 1)
Expand Down