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

Add automated release pipeline #355

Conversation

guenp
Copy link
Collaborator

@guenp guenp commented Mar 6, 2024

See packaging guide for setup instructions on PyPI:

Go to https://pypi.org/manage/account/publishing/.

Fill in the name you wish to publish your new PyPI project under (the name value in your setup.cfg or pyproject.toml), the GitHub repository owner’s name (org or user), and repository name, and the name of the release workflow file under the .github/ folder, see Creating a workflow definition. Finally, add the name of the GitHub Environment (pypi) we’re going set up under your repository. Register the trusted publisher.

Your “pending” publisher is now ready for their first use and will create your project automatically once you use them for the first time.

This was tested on TestPyPI (see: https://test.pypi.org/project/dbt-duckdb/)

@guenp
Copy link
Collaborator Author

guenp commented Mar 6, 2024

The pipeline currently triggers when you push a semver tag but still requires you to update the version manually, we can implement automated versioning e.g. with versioningit in a separate PR. Let me know what you think

--notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah I missed this earlier, looks like if we want to push an automatic release as well we need to set up a github token.

Copy link
Collaborator

Choose a reason for hiding this comment

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

okay cool-- so I need to set that up, somehow. It's int he docs you linked to?

Copy link
Collaborator Author

@guenp guenp Mar 6, 2024

Choose a reason for hiding this comment

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

Oh good point, no it's not. I'll open a PR to the packaging docs page to add a note.

I looked it up and looks like the token itself is automatically generated by GitHub, see docs.
However we would need to set the permissions so it has contents:write access, see docs.
See also this post on stackoverflow.

To change the permissions go to https://github.com/duckdb/dbt-duckdb/settings/actions and scroll down to "Workflow permissions" and choose "Read and write permissions".

Alternatively you can create a Personal Access Token and use that instead of the GITHUB_TOKEN.

If none of this sparks joy we can take this part out and just manually post release notes

Copy link
Collaborator Author

@guenp guenp Mar 6, 2024

Choose a reason for hiding this comment

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

Also just realized that right now it posts empty release notes (--notes "")
Maybe a nice follow up PR could be to add automated release notes?
See: https://github.com/marketplace/actions/release-notes-generator#use-github-action

Edit: nvm I can just use --generate-notes

@jwills jwills merged commit 9eedc6d into duckdb:master Mar 7, 2024
29 of 30 checks passed
@guenp guenp deleted the guen/eco-71-contribute-pypi-release-workflow-to-dbt-duckdb branch March 7, 2024 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants