Skip to content

Issues of the "Publish to PyPI" workflow #901

Closed

Description

@seisman

Description of the problem

The publish-to-pypi.yml workflow uploads the PyGMT packages to PyPI and/or TestPyPI.

During the release v0.3.0, we found an issue with the workflow and had a quick fix in #900.

When I reiviwed the workflow, I found two more issues:

  1. We're using secrets test_pypi_password and pypi_password in the pypa/gh-action-pypi-publish action.
    - name: Publish to Test PyPI
    uses: pypa/[email protected]
    with:
    password: ${{ secrets.test_pypi_password }}
    repository_url: https://test.pypi.org/legacy/
    - name: Publish to PyPI
    if: startsWith(github.ref, 'refs/tags')
    uses: pypa/[email protected]
    with:
    password: ${{ secrets.pypi_password }}

The names of these two secrets are confusing. They are API tokens (generated by me, if I remember correctly), not someone's passwords. We should rename them to better names, TEST_PYPI_API_TOKEN and PYPI_API_TOKEN following the official guide.

  1. The workflow always fails on forks, because forks don't have these secrets. We should skip the workflow for forks.

Activity

  1. added
    maintenance
    on Feb 15, 2021
  2. added this to the 0.4.0 milestone on Feb 15, 2021
  3. weiji14 commented on Feb 16, 2021

    @weiji14
    Member
    1. We should rename them to better names, TEST_PYPI_API_TOKEN and PYPI_API_TOKEN following the official guide.

    Ok, renaming TEST_PYPI_PASSWORD -> TEST_PYPI_API_TOKEN and PYPI_PASSWORD -> PYPI_API_TOKEN sounds good, I can do it in PR #900.

    1. The workflow always fails on forks, because forks don't have these secrets. We should skip the workflow for forks.

    You sure we want to hardcode disabling Github Actions workflows for forks? I know we can add a if: github.repository == 'GenericMappingTools/pygmt' line to the workflow, but:

    1. it will be hard for fork users to re-enable tests, unless they have good knowledge of Github Actions
    2. fork users can disable tests themselves anyway at https://docs.github.com/en/github/administering-a-repository/disabling-or-limiting-github-actions-for-a-repository.
    3. I thought tests will only run if people keep their fork/branch in sync with GenericMappingTools/pygmt? I.e. if they use the pull bot.
  4. seisman commented on Feb 16, 2021

    @seisman
    MemberAuthor

    You sure we want to hardcode disabling Github Actions workflows for forks? I know we can add a if: github.repository == 'GenericMappingTools/pygmt' line to the workflow, but:

    I meant to add this line to the "Publish to PyPI" workflow, because forks can't do the uploads anyway (they don't have the tokens), and we also don't want to see projects like pygmt-01, pygmt-forks on PyPI.

  5. seisman commented on Feb 16, 2021

    @seisman
    MemberAuthor

    For other workflows (e.g., Tests and GMT Dev Tests), I think they're disabled for forks by default but can be enabled following the documentation you just posted.

  6. modified the milestones: 0.4.0, 0.3.1 on Feb 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    maintenance

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions