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

updated cd workflow and Python Semantic Release table in pyproject.toml #71

Merged
merged 2 commits into from
Jan 21, 2024

Conversation

ttimbers
Copy link
Contributor

@ttimbers ttimbers commented Jan 21, 2024

This new cd workflow the the following changes:

  • uses a GHA for Python Semantic Release instead of a command Python Semantic Release version 8.3.0
  • upgraded to
  • drops the now redundant GHA commands (Install poetry, Install package)
  • added a conditional to publish to the package repositories (only do this if semantic release has a new release
  • used a GHA to generate the GitHub release

Note: there is a bug in the newest versions of Python Semantic Release that prevent poetry from working (see here). Thus we are pinning to version 8.3.0 for now until the fix is merged to main/master.

This new cd workflow the the following changes:
- uses  a GHA for Python Semantic Release instead of a command Python Semantic Release version 8.3.0
- upgraded to 
- drops the now redundant GHA commands (Install poetry, Install package)
- added a conditional to publish to the package repositories (only do this if semantic release has a new release
- used a GHA to generate the GitHub release
@ttimbers
Copy link
Contributor Author

ttimbers commented Jan 21, 2024

This changes require the new table in pyproject.toml to look like this:

[tool.semantic_release]
version_toml = [
    "pyproject.toml:tool.poetry.version",
] # version location
branch = "main"                             
changelog_file = "CHANGELOG.md"             
build_command = "pip install poetry && poetry build"              
upload_to_release = true                    
upload_to_pypi = true                     

A couple notes:

I think the only docs we need to update are the book for this table? Currently working here to do this.

@ttimbers ttimbers merged commit 550cb3a into main Jan 21, 2024
3 checks passed
Copy link
Collaborator

@TomasBeuzen TomasBeuzen left a comment

Choose a reason for hiding this comment

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

Cool this looks great to me - I remember having quite a bit of trouble getting PSR to work with GH Actions. Fantastic that they have their own action now, seems to have simplified things.

@TomasBeuzen
Copy link
Collaborator

TomasBeuzen commented Jan 21, 2024

@ttimbers - we want to modify the pyproject.toml file of the cookiecutter too right? To reflect these changes, i.e., change to what you have above (I can do it, just wondering if there was a reason we didn't yet):

[tool.semantic_release]
version_toml = [
    "pyproject.toml:tool.poetry.version",
] # version location
branch = "main"                             
changelog_file = "CHANGELOG.md"             
build_command = "pip install poetry && poetry build"              
upload_to_release = true                    
upload_to_pypi = true                     

@ttimbers
Copy link
Contributor Author

We actually do not need:

upload_to_release = true                    
upload_to_pypi = true 

So it just needs to be:

[tool.semantic_release]
version_toml = [
    "pyproject.toml:tool.poetry.version",
] # version location
branch = "main"                             
changelog_file = "CHANGELOG.md"             
build_command = "pip install poetry && poetry build"  

And yes, we should edit the pyproject.toml file of the cookiecutter too right! I forgot we had that in there because in the example I was working through I initially set it up without ci or cd, and then added it manually after! Will make this change now!

@ttimbers
Copy link
Contributor Author

oops! I accidentally directly added it to main here: 62fdd3a

Apologies, should have branched and PR'ed it (meant to but was using the pen tool and clicked the wrong radio button). Should we add main branch protection to this repo 😅

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.

2 participants