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

Bug: `no pypi-token.test_pypi setting` when publishing to test-pypi #37

Closed TiansuYu closed 1 year ago

TiansuYu commented 1 year ago

Please see this PR https://github.com/gventuri/pandas-ai/pull/112 to reproduce. We have set a similar workflow as the examples shown in README. However, the github action seems to have failed picking up pypi_token: ${{ secrets.PYPI_TOKEN }}for test-pypi (or any non-default repo).

TiansuYu commented 1 year ago

@JRubics

JRubics commented 1 year ago

Hi :) Please check if the repo exists on your registry and if the token has permissions for it

gventuri commented 1 year ago

Thanks @JRubics! So basically if the repo doesn't exist, we still get that same error complaining about missing api key?

JRubics commented 1 year ago

I think so, because the error says key.repo_name missing, so I would start with creating the repo

gventuri commented 1 year ago

Now getting this error @JRubics:

- Uploading pandasai-0.2.11-py3-none-any.whl 100%
HTTP Error 403: Invalid or non-existent authentication information. See https://test.pypi.org/help/#invalid-auth for more information. | b'<html>\n <head>\n  <title>403 Invalid or non-existent authentication information. See https://test.pypi.org/help/#invalid-auth for more information.\n \n <body>\n  <h1>403 Invalid or non-existent authentication information. See https://test.pypi.org/help/#invalid-auth for more information.\n  Access was denied to this resource.<br/><br/>\nInvalid or non-existent authentication information. See https://test.pypi.org/help/#invalid-auth for more infor

Here's my github action:

name: cd

on:
  release:
    types:
      - published

permissions:
  id-token: write
  contents: read

jobs:
  publish_to_pypi:
    name: publish to pypi on new release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: JRubics/poetry-publish@v1.16
        name: Build and publish to PyPI
        with:
          pypi_token: ${{ secrets.PYPI_TOKEN }}
          ignore_dev_requirements: "yes"
          repository_url: https://upload.pypi.org/
          repository_name: pandasai
JRubics commented 1 year ago

The action looks good to me. Please refer to this part in the doccumentation:

If you are using an [API Token](https://test.pypi.org/help/#apitoken) for uploads:

    - Ensure that your API Token is valid and has not been revoked.
    - Ensure that your API Token is [properly formatted](https://test.pypi.org/help/#apitoken) and does not contain any trailing characters such as newlines.
    - Ensure that the username you are using is __token__.

Are you able to use that token for pushes from your machine?

JRubics commented 1 year ago

Closing because of no activity