JRubics / poetry-publish

An action to build and publish python package to pypi (https://pypi.org/) using poetry (https://github.com/sdispater/poetry)
BSD 3-Clause "New" or "Revised" License
129 stars 17 forks source link

Python version not found #22

Closed ryan-salo closed 1 year ago

ryan-salo commented 1 year ago

I have a workflow that specifies python_version:

name: Project
on:
  push:
    tags:
      - "v*.*.*"
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Build and publish to pypi
        uses: JRubics/poetry-publish@v1.11
        with:
          python_version: "3.9.13"
          repository_name: private-repo
          repository_url: https:///private-pypi-repo/
          repository_username: ${{ secrets.USERNAME }}
          repository_password: ${{ secrets.PASSWORD }}

But the action errors out, saying it cannot find that python version:

usr/bin/docker run --name jrubicspoetrypublishv111_ba7e15 --label 4cd98f --workdir /github/workspace --rm -e INPUT_REPOSITORY_NAME -e INPUT_REPOSITORY_URL -e INPUT_REPOSITORY_USERNAME -e INPUT_REPOSITORY_PASSWORD -e INPUT_PYTHON_VERSION -e INPUT_ALLOW_POETRY_PRE_RELEASE -e INPUT_IGNORE_DEV_REQUIREMENTS -e INPUT_POETRY_VERSION -e INPUT_PYPI_TOKEN -e INPUT_BUILD_FORMAT -e INPUT_EXTRA_BUILD_DEPENDENCY_PACKAGES -e INPUT_PLUGINS -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_REF_NAME -e GITHUB_REF_PROTECTED -e GITHUB_REF_TYPE -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e GITHUB_STEP_SUMMARY -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/project/project":"/github/workspace" jrubics/poetry-publish:v1.11  "3.9.13" "latest" "" "private-repo" "https://private-pypi-repo/" "" "yes" "yes" "***" "***" "" ""
pyenv: Version '3.9.13' is not found.

It looks like 3.9.13 was added in pyenv so perhaps I'm formatting the workflow variables incorrectly?

JRubics commented 1 year ago

Hi :) Thank you for opening the issue! :)

Since we are using the pre-built docker image, it had the old version of pyenv that didn't have python version '3.9.13' available. For now, I updated the docker image, so it should work for you, but I will leave the issue open as a reminder to add a support to choose the pyenv version through the action parameters.

Please let me know if you have any other question or suggestion for the improvement. :)

ryan-salo commented 1 year ago

Thanks @JRubics for the quick response and fix! I updated to v1.12 of this action and everything worked!

jessebot commented 1 year ago

Hi @JRubics, thanks for all your work here. It's been very helpful! :) I am running into the same issue with python '3.11.0'. It looks like this version should also be in pyenv as of v2.3.6, which was just 13 days ago.

Here's my workflow file:

---
name: Python package
on:
  push:
    tags:
      - "v*.*.*"
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Build and publish to pypi
        uses: JRubics/poetry-publish@v1.13
        with:
          python_version: "3.11.0"
          pypi_token: ${{ secrets.PYPI_SECRET }}

and here's the return:

pyenv: Version '3.11.0' is not found.

Thank you for your time!

JRubics commented 1 year ago

Hi @jessebot :wave: Thank you for the notice :pray: I updated imge to have the latest version of pyenv. Please try it and let me know if you have any other issue :slightly_smiling_face:

jessebot commented 1 year ago

Gave it a shot after updating my workflow file to @1.14 and unfortunately it got a weird error:

0s
Run JRubics/poetry-publish@v1.14
  with:
    python_version: 3.11.0
    pypi_token: ***
    poetry_version: latest
/usr/bin/docker run --name jrubicspoetrypublishv114_80d7fc --label 290506 --workdir /github/workspace --rm -e "INPUT_PYTHON_VERSION" -e "INPUT_PYPI_TOKEN" -e "INPUT_POETRY_VERSION" -e "INPUT_REPOSITORY_NAME" -e "INPUT_REPOSITORY_URL" -e "INPUT_REPOSITORY_USERNAME" -e "INPUT_REPOSITORY_PASSWORD" -e "INPUT_BUILD_FORMAT" -e "INPUT_IGNORE_DEV_REQUIREMENTS" -e "INPUT_ALLOW_POETRY_PRE_RELEASE" -e "INPUT_EXTRA_BUILD_DEPENDENCY_PACKAGES" -e "INPUT_PLUGINS" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/onboardme/onboardme":"/github/workspace" jrubics/poetry-publish:v1.14  "3.11.0" "latest" "***" "" "" "" "" "" "" "" "" ""
pyenv: no installed versions match the prefix `install'

I think it's weird, because I looked at your commit, and nothing really seemed like it should have changed except the version number 🤔 I normally don't use pyenv, but installed it and it looks like you have to do pyenv install $VERSION, as latest will not work here according to the --help:

pyenv latest --help
Usage: pyenv latest [-k|--known] [-q|--quiet] <prefix>

  -k/--known      Select from all known versions instead of installed
  -q/--quiet      Do not print an error message on resolution failure

Perhaps in previous versions it worked, but it looks like this line needs to be updated from pyenv latest install $1 to `pyenv latest install $1:

https://github.com/JRubics/poetry-publish/blob/08cf729d9cca72df51aece96d0a6fd7ec882ebd9/entrypoint.sh#L12

Thank you again, and sorry for trouble!

JRubics commented 1 year ago

Hi, thank you for the investigation and PR. I merged it and released a new version with your fix :slightly_smiling_face:

During the weekend I will have time to investigate a little bit deeper if this doesn't solve your issue, sorry if this slows your development :slightly_smiling_face:

jessebot commented 1 year ago

That fixed it for me! :) Thank you and no problems at all. This is still such a time saver overall. Have a great weekend!

JRubics commented 1 year ago

Thank you, I'm happy to be able to help! You too :tada: