Skip to content

feat: create pypi publish github action #8

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

Merged
merged 2 commits into from
Jan 23, 2020

Conversation

steve148
Copy link
Contributor

What kind of change does this PR introduce?

Feature related to #6.

What is the current behavior?

Currently the release process is as follows:

  1. Pull the latest code in master.
  2. Update the version number in setup.py.
  3. Build the distribution.
  4. Upload the distribution to pypi.
  5. Create a git tag in github for the release.

While this is ok, there are a lot of manual steps to this which could fail due to a manual error.

What is the new behavior?

With github actions, whenever a new release is created for the repository, this github action will trigger and try to build and deploy the package to pypi. The build will use the code based on the git sha of the release.

This change will still require the manual process of upgrading the version number in setup.py before releasing, but it at least removes the manual steps of having to build and deploy the project.

Does this PR introduce a breaking change?

No breaking changes to the project 🎉

Other information

@steve148 steve148 requested review from DaleSeo and xkludge January 22, 2020 21:27
@steve148 steve148 self-assigned this Jan 22, 2020
@steve148 steve148 added enhancement New feature or request chore Things that improve the project but aren't necessarily new features. and removed enhancement New feature or request labels Jan 22, 2020
Copy link
Contributor

@DaleSeo DaleSeo left a comment

Choose a reason for hiding this comment

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

Due to my lack of knowledge in Github Actions, I'm not very confident but I can understand and imagine what this config file is trying to achieve. 😆 Hope this automates our release process as expected! 🙏

deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Maybe this step also deserves its name to be consistent with the rest of the steps?

Copy link
Contributor

Choose a reason for hiding this comment

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

Which branch gets checked out? The default branch?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A name can be added to this step for added clarity 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair question about which version of the code gets used, took me a bit to find more info on that when I first was getting into it. Basically when a github action gets triggered it will use the git_sha given by that trigger. In the case of the release trigger, it will use the git_sha in the release which should correspond to the version we want to release.

If you want to read more into here, I found the following articles helpful:
General info on workflow triggers - https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows#about-workflow-events
Release trigger - https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows#release-event-release

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this also install our own dependencies such as requests? Or, they don't even need to be installed to build the distribution?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure 🤔 I haven't seen any docs saying I need to install packages ahead of time, my guess is that the upload / build doesn't require installing dependencies, but let me see if I can find some documentation that explicitly mentions this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok so from quickly testing it out on the legacy pypi server, it seems having the dependencies installed locally is not required for packaging. That's pretty neat!

@steve148 steve148 force-pushed the feature/automate-pypi-releases branch from 0feac18 to 92c0d63 Compare January 23, 2020 18:50
@steve148
Copy link
Contributor Author

Rebased because I wanted to format the first commit to have yaml that didn't look ugly. Should be good to go now :shipit:

@steve148 steve148 merged commit 3d8c93b into master Jan 23, 2020
@steve148 steve148 deleted the feature/automate-pypi-releases branch January 23, 2020 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Things that improve the project but aren't necessarily new features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants