Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Publish package automatically (FLAPI-2004) #24

Merged
merged 8 commits into from
Dec 22, 2021
Merged

Conversation

sgerrand
Copy link
Contributor

@sgerrand sgerrand commented Dec 21, 2021

💁 These changes add a new workflow to publish the package to PyPI whenever a new tag is pushed to this repository.

Validation criteria

  1. Add publishing workflow, using pushes, pointing to https://test.pypi.org
  2. Validate that it works!
  3. Update the workflow to add a constraint for git tags, add live credentials, remove https://test.pypi.org
  4. Validate that it works!

Sasha Gerrand added 2 commits December 21, 2021 10:27
Renaming this workflow in preparation for adding a new publishing one.
This workflow will publish the package to https://test.pypi.org to allow
the workflow steps to be validated in an isolated manner.
@sgerrand sgerrand requested review from nlopes and jesse-c December 21, 2021 11:20
Copy link
Contributor

@jesse-c jesse-c left a comment

Choose a reason for hiding this comment

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

Looks reasonable so far.

@sgerrand
Copy link
Contributor Author

🏁 Successfully published a spurious version to the test version of PyPI in https://github.com/duffelhq/duffel-api-python/runs/4596393584?check_suite_focus=true.

@sgerrand
Copy link
Contributor Author

I'll make the publishing workflow require the test workflow to pass first.

The criteria for automating the steps required for publishing this
package to PyPI are:
1. The test suite should pass first
2. The publish job should only run when a tag is pushed to ensure that
   versions have matching tags in version control
3. Packages should only be published from `duffelhq/duffel-api-python`
   to prevent issues for contributors who may fork this repository

I'd thought that I could use separate workflows to achieve this but it's
immeasurably simpler to do this all in a single workflow.
@sgerrand
Copy link
Contributor Author

Reposting the commit message here for visibility!

The criteria for automating the steps required for publishing this
package to PyPI are:

  1. The test suite should pass first
  2. The publish job should only run when a tag is pushed to ensure that versions have matching tags in version control
  3. Packages should only be published from duffelhq/duffel-api-python to prevent issues for contributors who may fork this repository

I'd thought that I could use separate workflows to achieve this but after spending time in GitHub's documentation for Actions I think that it's immeasurably simpler to do this all in a single workflow.

@sgerrand
Copy link
Contributor Author

Now to test a release!

Mainly to test the publishing workflow "for real".
@sgerrand
Copy link
Contributor Author

🏁 Okay, it all works!

@sgerrand sgerrand requested a review from jesse-c December 21, 2021 16:48
@sgerrand
Copy link
Contributor Author

✅ Successfully published a new version to PyPI using this new workflow job: https://github.com/duffelhq/duffel-api-python/runs/4597586080?check_suite_focus=true

Copy link
Contributor

@jesse-c jesse-c left a comment

Choose a reason for hiding this comment

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

LGTM

.github/workflows/main.yaml Outdated Show resolved Hide resolved
As suggested by @jesse-c, thanks Jesse!

Co-authored-by: Jesse Claven <[email protected]>
@sgerrand
Copy link
Contributor Author

Norberto, (if you have time!) let me know what you think of this approach.

setup.py Outdated Show resolved Hide resolved
@nlopes
Copy link
Contributor

nlopes commented Dec 21, 2021

Happy with the approach.

Sasha Gerrand added 2 commits December 22, 2021 09:38
Without this a version string like 1.0.0-rc1 would be skipped.
@sgerrand sgerrand enabled auto-merge December 22, 2021 09:40
@sgerrand sgerrand disabled auto-merge December 22, 2021 09:44
@sgerrand sgerrand merged commit 45bc745 into main Dec 22, 2021
@sgerrand sgerrand deleted the automatic-releases branch December 22, 2021 09:44
sgerrand added a commit that referenced this pull request Dec 24, 2021
I changed the workflow name as part of #24 but neglected to change this as well. Mea culpa!
@sgerrand sgerrand mentioned this pull request Dec 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants