Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove windows-only logic from the action #95

Merged
merged 1 commit into from Oct 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 8 additions & 17 deletions main.sh
Expand Up @@ -5,11 +5,7 @@ set -eo pipefail
installation_script="$(mktemp)"
curl -sSL https://install.python-poetry.org/ --output "$installation_script"

if [ "${RUNNER_OS}" == "Windows" ]; then
path="C:/Users/runneradmin/AppData/Roaming/Python/Scripts"
else
path="$HOME/.local"
fi
path="$HOME/.local"

echo -e "\n\033[33mSetting Poetry installation path as $path\033[0m\n"
echo -e "\033[33mInstalling Poetry 👷\033[0m\n"
Expand All @@ -26,26 +22,21 @@ fi
echo "$path/bin" >>"$GITHUB_PATH"
export PATH="$path/bin:$PATH"

if [ "${RUNNER_OS}" == "Windows" ]; then
poetry_="$path/bin/poetry.exe"
else
poetry_=poetry
fi

# Expand any "~" in VIRTUALENVS_PATH
VIRTUALENVS_PATH="${VIRTUALENVS_PATH/#\~/$HOME}"

"$poetry_" config virtualenvs.create "${VIRTUALENVS_CREATE}"
"$poetry_" config virtualenvs.in-project "${VIRTUALENVS_IN_PROJECT}"
"$poetry_" config virtualenvs.path "${VIRTUALENVS_PATH}"
poetry config virtualenvs.create "${VIRTUALENVS_CREATE}"
poetry config virtualenvs.in-project "${VIRTUALENVS_IN_PROJECT}"
poetry config virtualenvs.path "${VIRTUALENVS_PATH}"

config="$("$poetry_" config --list)"
config="$(poetry config --list)"

if echo "$config" | grep -q -c "installer.parallel"; then
"$poetry_" config installer.parallel "${INSTALLER_PARALLEL}"
poetry config installer.parallel "$INSTALLER_PARALLEL"
fi

if [ "${RUNNER_OS}" == "Windows" ]; then
if [ "$RUNNER_OS" == "Windows" ]; then
# When inside a virtualenv, python uses the scripts dir, with no shortcut
act="source .venv/scripts/activate"
echo "VENV=.venv/scripts/activate" >>"$GITHUB_ENV"
else
Expand Down