Skip to content

Commit

Permalink
Try creating venv, then install venv package and try again
Browse files Browse the repository at this point in the history
  • Loading branch information
EnricoMi committed Jan 22, 2024
1 parent 94248a1 commit 95c6c64
Showing 1 changed file with 7 additions and 25 deletions.
32 changes: 7 additions & 25 deletions composite/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,22 +179,6 @@ runs:
echo '##[endgroup]'
shell: bash

- name: Check for venv package
id: check-venv
run: |
python3 >> $GITHUB_OUTPUT << EOF
try:
import virtualenv
print("venv=virtualenv")
except:
try:
import venv
print("venv=venv")
except:
print("venv=none")
EOF
shell: bash

- name: Detect OS
id: os
run: |
Expand Down Expand Up @@ -227,18 +211,17 @@ runs:
PIP_OPTIONS: ${{ steps.os.outputs.pip-options }}
run: |
echo '##[group]Create virtualenv'
# install virtualenv, if it is not yet installed
# create virtual environment
if [ "${{ steps.check-venv.outputs.venv }}" == "none" ]
if [[ ! python3 -m virtualenv enricomi-publish-action-venv ]] && [[ ! python3 -m venv enricomi-publish-action-venv ]]
then
echo "No venv package installed"
echo "Looks like no venv package installed"
python3 -m pip install $PIP_OPTIONS virtualenv
python3 -m virtualenv enricomi-publish-action-venv
else
echo "Venv package installed: ${{ steps.check-venv.outputs.venv }}"
python3 -m "${{ steps.check-venv.outputs.venv }}" enricomi-publish-action-venv
if [[ ! python3 -m virtualenv enricomi-publish-action-venv ]] && [[ ! python3 -m venv enricomi-publish-action-venv ]]
then
echo "Still no luck creating a venv"
fi
fi
echo "venv installed:"
echo "installed venv:"
ls -lahR enricomi-publish-action-venv
# test activating virtualenv
Expand All @@ -248,7 +231,6 @@ runs:
Windows*)
source enricomi-publish-action-venv\\Scripts\\activate;;
esac
which python3
echo '##[endgroup]'
shell: bash

Expand Down

0 comments on commit 95c6c64

Please sign in to comment.