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

Issues of the "Publish to PyPI" workflow #901

Closed
seisman opened this issue Feb 15, 2021 · 3 comments · Fixed by #900
Closed

Issues of the "Publish to PyPI" workflow #901

seisman opened this issue Feb 15, 2021 · 3 comments · Fixed by #900
Labels
maintenance Boring but important stuff for the core devs
Milestone

Comments

@seisman
Copy link
Member

seisman commented Feb 15, 2021

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/gh-action-pypi-publish@v1.4.2
    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/gh-action-pypi-publish@v1.4.2
    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.
@seisman seisman added the maintenance Boring but important stuff for the core devs label Feb 15, 2021
@seisman seisman added this to the 0.4.0 milestone Feb 15, 2021
@weiji14
Copy link
Member

weiji14 commented Feb 16, 2021

  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.

@seisman
Copy link
Member Author

seisman commented Feb 16, 2021

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.

@seisman
Copy link
Member Author

seisman commented Feb 16, 2021

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.

@seisman seisman modified the milestones: 0.4.0, 0.3.1 Feb 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Boring but important stuff for the core devs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants