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

Automate releases based on git tags #73

Merged
merged 1 commit into from
Oct 30, 2023

Conversation

JWCook
Copy link
Collaborator

@JWCook JWCook commented Oct 30, 2023

Closes #72

Changes

  • Pushing a git tag triggers the workflow in .github/workflows/release.yml
  • This builds the package wheel and sdist, and publishes them to PyPI using GitHub as a trusted publisher.
  • It also creates a new GitHub release with placeholder text linking to the changelog. You can customize this and other settings documented here.

PyPI setup

To enable this on the PyPI end, you can go to Manage -> Publishing -> Add a new publisher.

  • owner/repository: melissawm/sphinx-tags
  • workflow name: release.yml
  • environment name: None

More details in the PyPI docs here.

Notes

  • You can still publish releases manually if you need to. If you do that and then push a new tag, the action will just fail because a release with the specified version already exists. It shouldn't cause any problems.
  • Feel free to ping me in the future if you have any problems with this, or want help updating this workflow to do something different.

@JWCook JWCook force-pushed the tag-based-releases branch 3 times, most recently from 4e0fb15 to 3a8cb4e Compare October 30, 2023 18:17
@JWCook JWCook changed the title Add action to publish packages based on git tags Automate releases based on git tags Oct 30, 2023
@JWCook JWCook force-pushed the tag-based-releases branch from 3a8cb4e to 8819f45 Compare October 30, 2023 18:27
@JWCook JWCook marked this pull request as ready for review October 30, 2023 18:29
uses: pypa/gh-action-pypi-publish@release/v1
- name: Create GitHub release
uses: softprops/action-gh-release@v1
body: "See [changelog](https://github.com/melissawm/sphinx-tags/blob/main/CHANGELOG.md) for release details."
Copy link
Owner

Choose a reason for hiding this comment

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

So to update this link, I would go into the PyPI page for this release and edit the link there, correct?

Copy link
Collaborator Author

@JWCook JWCook Oct 30, 2023

Choose a reason for hiding this comment

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

No, that's what will show up under GitHub releases, not PyPI. I imagine you will want to manually add a release description for each new release, but you can edit the body option here to add some useful placeholder text, or a template, or something like that. Or just leave it blank if you prefer.

Copy link
Owner

Choose a reason for hiding this comment

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

Ah sounds good! Thanks! Let's try 😄

@melissawm melissawm merged commit f82097a into melissawm:main Oct 30, 2023
@JWCook JWCook deleted the tag-based-releases branch October 30, 2023 19:16
@JWCook
Copy link
Collaborator Author

JWCook commented Oct 30, 2023

Ah, sorry, looks like I forgot to put that setting under with. I'll fix that shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Publish releases based on git tags
2 participants