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

Ensure proper non-dev version string when publishing to PyPI #900

Merged
merged 9 commits into from Feb 16, 2021

Conversation

weiji14
Copy link
Member

@weiji14 weiji14 commented Feb 15, 2021

Description of proposed changes

Ensures that the PyPI release Github Action workflow has a proper version string like v0.3.0 instead of v0.3.1.dev0. Also edit the Publish-to-PyPI workflow to only run on GenericMappingTools/pygmt and rename secrets from *_PYPI_PASSWORD to *_PYPI_API_TOKEN

Publish Publish Github Action Documentation is at https://github.com/pypa/gh-action-pypi-publish/tree/v1.4.2

Addresses #845 (comment), also fixes #901.

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If adding new functionality, add an example to docstrings or tutorials.

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash commands are:

  • /format: automatically format and lint the code
  • /test-gmt-dev: run full tests on the latest GMT development version

@weiji14 weiji14 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
@seisman
Copy link
Member

seisman commented Feb 16, 2021

Please see #901, and let me know if you want to fix it in this PR.

@weiji14
Copy link
Member Author

weiji14 commented Feb 16, 2021

Please see #901, and let me know if you want to fix it in this PR.

Ok, I think the issues in #901 have been addressed, but please double check. Note: Will need to rename TEST_PYPI_PASSWORD -> TEST_PYPI_API_TOKEN and PYPI_PASSWORD -> PYPI_API_TOKEN before merging this PR.

- name: Fix up version string
# This step is only necessary for testing purposes and for TestPyPI
- name: Fix up version string for TestPyPI
if: ${{ !startsWith(github.ref, 'refs/tags') }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand it correctly, when we make a release/tag, this sed command won't run. So, we are pushing the same versions (e.g., v0.3.1) to both PyPI and TestPyPI, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, correct. But I think pushing v0.3.1 to both PyPI and TestPyPI is fine right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it looks good.

@seisman seisman modified the milestones: 0.4.0, 0.3.1 Feb 16, 2021
Copy link
Member

@seisman seisman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Things to do before merging:

  1. Rename the secrets in https://github.com/GenericMappingTools/pygmt/settings/secrets/actions
  2. Update the PR title

- name: Fix up version string
# This step is only necessary for testing purposes and for TestPyPI
- name: Fix up version string for TestPyPI
if: ${{ !startsWith(github.ref, 'refs/tags') }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it looks good.

@weiji14 weiji14 changed the title Don't edit setuptools-scm for PyPI releases Ensure proper non-dev version string when publishing to PyPI Feb 16, 2021
@weiji14
Copy link
Member Author

weiji14 commented Feb 16, 2021

Things to do before merging:

1. Rename the secrets in https://github.com/GenericMappingTools/pygmt/settings/secrets/actions

Ok, generated new tokens and created new secrets for PyPI and TestPyPI. Also deleted the old TEST_PYPI_PASSWORD and PYPI_PASSWORD secrets at https://github.com/GenericMappingTools/pygmt/settings/secrets/actions.

2. Update the PR title

See if it looks ok, having trouble describing this PR 😅

Copy link
Member

@seisman seisman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@weiji14
Copy link
Member Author

weiji14 commented Feb 16, 2021

I might trigger a quick test (to TestPyPI) just to make sure things work. Edit: Yep, it works, see https://github.com/GenericMappingTools/pygmt/pull/900/checks?check_run_id=1913789675.

@weiji14 weiji14 merged commit 4ef9038 into master Feb 16, 2021
@weiji14 weiji14 deleted the publish-to-pypi-correctly branch February 16, 2021 20:50
sixy6e pushed a commit to sixy6e/pygmt that referenced this pull request Dec 21, 2022
…MappingTools#900)

* Don't edit setuptools-scm for PyPI releases
* Move up comment on 'Fix up version string for TestPyPI' step
* Only run the Publish to PyPI workflow on GenericMappingTools/pygmt
* Rename secrets from PYPI_PASSWORD to PYPI_API_TOKEN
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 this pull request may close these issues.

Issues of the "Publish to PyPI" workflow
2 participants