python-semantic-release 10.2.0__tar.gz → 10.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/PKG-INFO +3 -3
  2. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/README.rst +2 -2
  3. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/docs/concepts/getting_started.rst +1 -1
  4. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/docs/configuration/automatic-releases/github-actions.rst +59 -7
  5. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/pyproject.toml +1 -1
  6. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/cli/commands/version.py +39 -28
  7. python_semantic_release-10.3.0/src/semantic_release/cli/github_actions_output.py +150 -0
  8. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/cli/util.py +2 -2
  9. python_semantic_release-10.3.0/tests/e2e/cmd_version/test_version_github_actions.py +123 -0
  10. python_semantic_release-10.3.0/tests/unit/semantic_release/cli/test_github_actions_output.py +161 -0
  11. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/util.py +33 -1
  12. python_semantic_release-10.2.0/src/semantic_release/cli/github_actions_output.py +0 -76
  13. python_semantic_release-10.2.0/tests/e2e/cmd_version/test_version_github_actions.py +0 -50
  14. python_semantic_release-10.2.0/tests/unit/semantic_release/cli/test_github_actions_output.py +0 -87
  15. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/LICENSE +0 -0
  16. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/MANIFEST.in +0 -0
  17. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/docs/Makefile +0 -0
  18. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/docs/api/commands.rst +0 -0
  19. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/docs/concepts/changelog_templates.rst +0 -0
  20. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/docs/concepts/commit_parsing.rst +0 -0
  21. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/docs/concepts/index.rst +0 -0
  22. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/docs/concepts/installation.rst +0 -0
  23. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/docs/concepts/multibranch_releases.rst +0 -0
  24. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/docs/concepts/strict_mode.rst +0 -0
  25. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/docs/conf.py +0 -0
  26. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/docs/configuration/automatic-releases/cronjobs.rst +0 -0
  27. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/docs/configuration/automatic-releases/index.rst +0 -0
  28. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/docs/configuration/automatic-releases/travis.rst +0 -0
  29. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/docs/configuration/configuration-guides/index.rst +0 -0
  30. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/docs/configuration/configuration-guides/uv_integration.rst +0 -0
  31. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/docs/configuration/configuration.rst +0 -0
  32. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/docs/configuration/index.rst +0 -0
  33. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/docs/contributing/contributing_guide.rst +0 -0
  34. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/docs/contributing/index.rst +0 -0
  35. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/docs/index.rst +0 -0
  36. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/docs/make.bat +0 -0
  37. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/docs/misc/psr_changelog.rst +0 -0
  38. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/docs/misc/troubleshooting.rst +0 -0
  39. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/docs/upgrading/08-upgrade.rst +0 -0
  40. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/docs/upgrading/09-upgrade.rst +0 -0
  41. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/docs/upgrading/10-upgrade.rst +0 -0
  42. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/docs/upgrading/index.rst +0 -0
  43. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/setup.cfg +0 -0
  44. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/python_semantic_release.egg-info/SOURCES.txt +0 -0
  45. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/__init__.py +0 -0
  46. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/__main__.py +0 -0
  47. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/changelog/__init__.py +0 -0
  48. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/changelog/context.py +0 -0
  49. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/changelog/release_history.py +0 -0
  50. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/changelog/template.py +0 -0
  51. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/cli/__init__.py +0 -0
  52. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/cli/changelog_writer.py +0 -0
  53. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/cli/cli_context.py +0 -0
  54. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/cli/commands/__init__.py +0 -0
  55. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/cli/commands/changelog.py +0 -0
  56. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/cli/commands/generate_config.py +0 -0
  57. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/cli/commands/main.py +0 -0
  58. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/cli/commands/publish.py +0 -0
  59. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/cli/config.py +0 -0
  60. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/cli/const.py +0 -0
  61. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/cli/masking_filter.py +0 -0
  62. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/commit_parser/__init__.py +0 -0
  63. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/commit_parser/_base.py +0 -0
  64. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/commit_parser/angular.py +0 -0
  65. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/commit_parser/conventional.py +0 -0
  66. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/commit_parser/emoji.py +0 -0
  67. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/commit_parser/scipy.py +0 -0
  68. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/commit_parser/tag.py +0 -0
  69. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/commit_parser/token.py +0 -0
  70. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/commit_parser/util.py +0 -0
  71. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/const.py +0 -0
  72. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/data/templates/conventional/md/.components/changelog_header.md.j2 +0 -0
  73. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/data/templates/conventional/md/.components/changelog_init.md.j2 +0 -0
  74. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/data/templates/conventional/md/.components/changelog_update.md.j2 +0 -0
  75. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/data/templates/conventional/md/.components/changes.md.j2 +0 -0
  76. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/data/templates/conventional/md/.components/first_release.md.j2 +0 -0
  77. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/data/templates/conventional/md/.components/macros.md.j2 +0 -0
  78. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/data/templates/conventional/md/.components/unreleased_changes.md.j2 +0 -0
  79. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/data/templates/conventional/md/.components/versioned_changes.md.j2 +0 -0
  80. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/data/templates/conventional/md/.release_notes.md.j2 +0 -0
  81. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/data/templates/conventional/md/CHANGELOG.md.j2 +0 -0
  82. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/data/templates/conventional/rst/.components/changelog_header.rst.j2 +0 -0
  83. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/data/templates/conventional/rst/.components/changelog_init.rst.j2 +0 -0
  84. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/data/templates/conventional/rst/.components/changelog_update.rst.j2 +0 -0
  85. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/data/templates/conventional/rst/.components/changes.rst.j2 +0 -0
  86. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/data/templates/conventional/rst/.components/first_release.rst.j2 +0 -0
  87. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/data/templates/conventional/rst/.components/macros.rst.j2 +0 -0
  88. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/data/templates/conventional/rst/.components/unreleased_changes.rst.j2 +0 -0
  89. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/data/templates/conventional/rst/.components/versioned_changes.rst.j2 +0 -0
  90. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/data/templates/conventional/rst/CHANGELOG.rst.j2 +0 -0
  91. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/enums.py +0 -0
  92. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/errors.py +0 -0
  93. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/gitproject.py +0 -0
  94. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/globals.py +0 -0
  95. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/helpers.py +0 -0
  96. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/hvcs/__init__.py +0 -0
  97. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/hvcs/_base.py +0 -0
  98. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/hvcs/bitbucket.py +0 -0
  99. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/hvcs/gitea.py +0 -0
  100. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/hvcs/github.py +0 -0
  101. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/hvcs/gitlab.py +0 -0
  102. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/hvcs/remote_hvcs_base.py +0 -0
  103. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/hvcs/token_auth.py +0 -0
  104. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/hvcs/util.py +0 -0
  105. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/py.typed +0 -0
  106. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/version/__init__.py +0 -0
  107. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/version/algorithm.py +0 -0
  108. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/version/declaration.py +0 -0
  109. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/version/declarations/__init__.py +0 -0
  110. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/version/declarations/enum.py +0 -0
  111. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/version/declarations/i_version_replacer.py +0 -0
  112. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/version/declarations/pattern.py +0 -0
  113. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/version/declarations/toml.py +0 -0
  114. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/version/translator.py +0 -0
  115. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/src/semantic_release/version/version.py +0 -0
  116. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/__init__.py +0 -0
  117. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/conftest.py +0 -0
  118. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/const.py +0 -0
  119. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/__init__.py +0 -0
  120. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_changelog/__init__.py +0 -0
  121. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_changelog/test_changelog.py +0 -0
  122. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_changelog/test_changelog_custom_parser.py +0 -0
  123. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_changelog/test_changelog_parsing.py +0 -0
  124. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_changelog/test_changelog_release_notes.py +0 -0
  125. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_config/__init__.py +0 -0
  126. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_config/test_generate_config.py +0 -0
  127. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_publish/__init__.py +0 -0
  128. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_publish/test_publish.py +0 -0
  129. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_version/__init__.py +0 -0
  130. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_version/bump_version/__init__.py +0 -0
  131. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_version/bump_version/conftest.py +0 -0
  132. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_version/bump_version/git_flow/__init__.py +0 -0
  133. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_version/bump_version/git_flow/test_repo_1_channel.py +0 -0
  134. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_version/bump_version/git_flow/test_repo_2_channels.py +0 -0
  135. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_version/bump_version/git_flow/test_repo_3_channels.py +0 -0
  136. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_version/bump_version/git_flow/test_repo_4_channels.py +0 -0
  137. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_version/bump_version/github_flow/__init__.py +0 -0
  138. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_version/bump_version/github_flow/test_repo_1_channel.py +0 -0
  139. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_version/bump_version/github_flow/test_repo_1_channel_branch_update_merge.py +0 -0
  140. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_version/bump_version/github_flow/test_repo_2_channels.py +0 -0
  141. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_version/bump_version/trunk_based_dev/__init__.py +0 -0
  142. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_version/bump_version/trunk_based_dev/test_repo_trunk.py +0 -0
  143. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_version/bump_version/trunk_based_dev/test_repo_trunk_dual_version_support.py +0 -0
  144. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_version/bump_version/trunk_based_dev/test_repo_trunk_dual_version_support_w_prereleases.py +0 -0
  145. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_version/bump_version/trunk_based_dev/test_repo_trunk_w_prereleases.py +0 -0
  146. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_version/test_version.py +0 -0
  147. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_version/test_version_build.py +0 -0
  148. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_version/test_version_bump.py +0 -0
  149. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_version/test_version_changelog.py +0 -0
  150. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_version/test_version_changelog_custom_commit_msg.py +0 -0
  151. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_version/test_version_print.py +0 -0
  152. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_version/test_version_release_notes.py +0 -0
  153. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_version/test_version_stamp.py +0 -0
  154. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/cmd_version/test_version_strict.py +0 -0
  155. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/conftest.py +0 -0
  156. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/test_help.py +0 -0
  157. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/e2e/test_main.py +0 -0
  158. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/fixtures/__init__.py +0 -0
  159. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/fixtures/commit_parsers.py +0 -0
  160. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/fixtures/example_project.py +0 -0
  161. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/fixtures/git_repo.py +0 -0
  162. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/fixtures/repos/__init__.py +0 -0
  163. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/fixtures/repos/git_flow/__init__.py +0 -0
  164. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/fixtures/repos/git_flow/repo_w_1_release_channel.py +0 -0
  165. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/fixtures/repos/git_flow/repo_w_2_release_channels.py +0 -0
  166. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/fixtures/repos/git_flow/repo_w_3_release_channels.py +0 -0
  167. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/fixtures/repos/git_flow/repo_w_4_release_channels.py +0 -0
  168. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/fixtures/repos/github_flow/__init__.py +0 -0
  169. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/fixtures/repos/github_flow/repo_w_default_release.py +0 -0
  170. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/fixtures/repos/github_flow/repo_w_default_release_w_branch_update_merge.py +0 -0
  171. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/fixtures/repos/github_flow/repo_w_release_channels.py +0 -0
  172. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/fixtures/repos/repo_initial_commit.py +0 -0
  173. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/fixtures/repos/trunk_based_dev/__init__.py +0 -0
  174. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/fixtures/repos/trunk_based_dev/repo_w_dual_version_support.py +0 -0
  175. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/fixtures/repos/trunk_based_dev/repo_w_dual_version_support_w_prereleases.py +0 -0
  176. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/fixtures/repos/trunk_based_dev/repo_w_no_tags.py +0 -0
  177. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/fixtures/repos/trunk_based_dev/repo_w_prereleases.py +0 -0
  178. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/fixtures/repos/trunk_based_dev/repo_w_tags.py +0 -0
  179. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/fixtures/scipy.py +0 -0
  180. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/__init__.py +0 -0
  181. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/conftest.py +0 -0
  182. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/__init__.py +0 -0
  183. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/changelog/__init__.py +0 -0
  184. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/changelog/conftest.py +0 -0
  185. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/changelog/test_changelog_context.py +0 -0
  186. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/changelog/test_default_changelog.py +0 -0
  187. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/changelog/test_release_history.py +0 -0
  188. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/changelog/test_release_notes.py +0 -0
  189. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/changelog/test_template.py +0 -0
  190. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/changelog/test_template_render.py +0 -0
  191. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/cli/__init__.py +0 -0
  192. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/cli/test_config.py +0 -0
  193. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/cli/test_masking_filter.py +0 -0
  194. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/cli/test_util.py +0 -0
  195. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/cli/test_version.py +0 -0
  196. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/commit_parser/__init__.py +0 -0
  197. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/commit_parser/test_conventional.py +0 -0
  198. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/commit_parser/test_emoji.py +0 -0
  199. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/commit_parser/test_parsed_commit.py +0 -0
  200. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/commit_parser/test_scipy.py +0 -0
  201. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/commit_parser/test_util.py +0 -0
  202. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/hvcs/__init__.py +0 -0
  203. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/hvcs/test__base.py +0 -0
  204. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/hvcs/test_bitbucket.py +0 -0
  205. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/hvcs/test_gitea.py +0 -0
  206. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/hvcs/test_github.py +0 -0
  207. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/hvcs/test_gitlab.py +0 -0
  208. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/hvcs/test_token_auth.py +0 -0
  209. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/hvcs/test_util.py +0 -0
  210. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/test_helpers.py +0 -0
  211. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/version/__init__.py +0 -0
  212. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/version/declarations/__init__.py +0 -0
  213. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/version/declarations/test_pattern_declaration.py +0 -0
  214. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/version/declarations/test_toml_declaration.py +0 -0
  215. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/version/test_algorithm.py +0 -0
  216. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/version/test_translator.py +0 -0
  217. {python_semantic_release-10.2.0 → python_semantic_release-10.3.0}/tests/unit/semantic_release/version/test_version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-semantic-release
3
- Version: 10.2.0
3
+ Version: 10.3.0
4
4
  Summary: Automatic Semantic Versioning for Python projects
5
5
  Author-email: Rolf Erik Lekang <me@rolflekang.com>
6
6
  License: MIT
@@ -88,5 +88,5 @@ The usage information and examples for this GitHub Action is available under
88
88
  the `GitHub Actions section`_ of `python-semantic-release.readthedocs.io`_.
89
89
 
90
90
  .. _python-semantic-release: https://pypi.org/project/python-semantic-release/
91
- .. _python-semantic-release.readthedocs.io: https://python-semantic-release.readthedocs.io/en/latest/
92
- .. _GitHub Actions section: https://python-semantic-release.readthedocs.io/en/latest/automatic-releases/github-actions.html
91
+ .. _python-semantic-release.readthedocs.io: https://python-semantic-release.readthedocs.io/en/stable/
92
+ .. _GitHub Actions section: https://python-semantic-release.readthedocs.io/en/stable/configuration/automatic-releases/github-actions.html
@@ -18,5 +18,5 @@ The usage information and examples for this GitHub Action is available under
18
18
  the `GitHub Actions section`_ of `python-semantic-release.readthedocs.io`_.
19
19
 
20
20
  .. _python-semantic-release: https://pypi.org/project/python-semantic-release/
21
- .. _python-semantic-release.readthedocs.io: https://python-semantic-release.readthedocs.io/en/latest/
22
- .. _GitHub Actions section: https://python-semantic-release.readthedocs.io/en/latest/automatic-releases/github-actions.html
21
+ .. _python-semantic-release.readthedocs.io: https://python-semantic-release.readthedocs.io/en/stable/
22
+ .. _GitHub Actions section: https://python-semantic-release.readthedocs.io/en/stable/configuration/automatic-releases/github-actions.html
@@ -215,7 +215,7 @@ To set commit exclusion patterns for a conventional commits parsers, add the fol
215
215
 
216
216
  .. code-block:: toml
217
217
 
218
- [tool.semantic_release.changelog.exclude_commit_patterns]
218
+ [tool.semantic_release.changelog]
219
219
  # Recommended patterns for conventional commits parser that is scope aware
220
220
  exclude_commit_patterns = [
221
221
  '''chore(?:\([^)]*?\))?: .+''',
@@ -513,6 +513,20 @@ and any actions that were taken.
513
513
 
514
514
  ----
515
515
 
516
+ .. _gh_actions-psr-outputs-commit_sha:
517
+
518
+ ``commit_sha``
519
+ """"""""""""""
520
+
521
+ **Type:** ``string``
522
+
523
+ The commit SHA of the release if a release was made, otherwise an empty string.
524
+
525
+ Example upon release: ``d4c3b2a1e0f9c8b7a6e5d4c3b2a1e0f9c8b7a6e5``
526
+ Example when no release was made: ``""``
527
+
528
+ ----
529
+
516
530
  .. _gh_actions-psr-outputs-is_prerelease:
517
531
 
518
532
  ``is_prerelease``
@@ -524,6 +538,32 @@ A boolean value indicating whether the released version is a prerelease.
524
538
 
525
539
  ----
526
540
 
541
+ .. _gh_actions-psr-outputs-link:
542
+
543
+ ``link``
544
+ """"""""
545
+
546
+ **Type:** ``string``
547
+
548
+ The URL link to the release if a release was made, otherwise an empty string.
549
+
550
+ Example upon release: ``https://github.com/user/repo/releases/tag/v1.2.3``
551
+ Example when no release was made: ``""``
552
+
553
+ ----
554
+
555
+ .. _gh_actions-psr-outputs-previous_version:
556
+
557
+ ``previous_version``
558
+ """"""""""""""""""""
559
+
560
+ **Type:** ``string``
561
+
562
+ The previous version before the release, if a release was or will be made. If no release is detected,
563
+ this will be the current version or an empty string if no previous version exists.
564
+
565
+ ----
566
+
527
567
  .. _gh_actions-psr-outputs-released:
528
568
 
529
569
  ``released``
@@ -535,6 +575,18 @@ A boolean value indicating whether a release was made.
535
575
 
536
576
  ----
537
577
 
578
+ .. _gh_actions-psr-outputs-release_notes:
579
+
580
+ ``release_notes``
581
+ """""""""""""""""""
582
+
583
+ **Type:** ``string``
584
+
585
+ The release notes generated by the release, if any. If no release was made,
586
+ this will be an empty string.
587
+
588
+ ----
589
+
538
590
  .. _gh_actions-psr-outputs-version:
539
591
 
540
592
  ``version``
@@ -873,14 +925,14 @@ to the GitHub Release Assets as well.
873
925
  - name: Action | Semantic Version Release
874
926
  id: release
875
927
  # Adjust tag with desired version if applicable.
876
- uses: python-semantic-release/python-semantic-release@v10.2.0
928
+ uses: python-semantic-release/python-semantic-release@v10.3.0
877
929
  with:
878
930
  github_token: ${{ secrets.GITHUB_TOKEN }}
879
931
  git_committer_name: "github-actions"
880
932
  git_committer_email: "actions@users.noreply.github.com"
881
933
 
882
934
  - name: Publish | Upload to GitHub Release Assets
883
- uses: python-semantic-release/publish-action@v10.2.0
935
+ uses: python-semantic-release/publish-action@v10.3.0
884
936
  if: steps.release.outputs.released == 'true'
885
937
  with:
886
938
  github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -979,7 +1031,7 @@ The equivalent GitHub Action configuration would be:
979
1031
 
980
1032
  - name: Action | Semantic Version Release
981
1033
  # Adjust tag with desired version if applicable.
982
- uses: python-semantic-release/python-semantic-release@v10.2.0
1034
+ uses: python-semantic-release/python-semantic-release@v10.3.0
983
1035
  with:
984
1036
  github_token: ${{ secrets.GITHUB_TOKEN }}
985
1037
  force: patch
@@ -1038,14 +1090,14 @@ Publish Action.
1038
1090
 
1039
1091
  - name: Release submodule 1
1040
1092
  id: release-submod-1
1041
- uses: python-semantic-release/python-semantic-release@v10.2.0
1093
+ uses: python-semantic-release/python-semantic-release@v10.3.0
1042
1094
  with:
1043
1095
  directory: ${{ env.SUBMODULE_1_DIR }}
1044
1096
  github_token: ${{ secrets.GITHUB_TOKEN }}
1045
1097
 
1046
1098
  - name: Release submodule 2
1047
1099
  id: release-submod-2
1048
- uses: python-semantic-release/python-semantic-release@v10.2.0
1100
+ uses: python-semantic-release/python-semantic-release@v10.3.0
1049
1101
  with:
1050
1102
  directory: ${{ env.SUBMODULE_2_DIR }}
1051
1103
  github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -1057,7 +1109,7 @@ Publish Action.
1057
1109
  # ------------------------------------------------------------------- #
1058
1110
 
1059
1111
  - name: Publish | Upload package 1 to GitHub Release Assets
1060
- uses: python-semantic-release/publish-action@v10.2.0
1112
+ uses: python-semantic-release/publish-action@v10.3.0
1061
1113
  if: steps.release-submod-1.outputs.released == 'true'
1062
1114
  with:
1063
1115
  directory: ${{ env.SUBMODULE_1_DIR }}
@@ -1065,7 +1117,7 @@ Publish Action.
1065
1117
  tag: ${{ steps.release-submod-1.outputs.tag }}
1066
1118
 
1067
1119
  - name: Publish | Upload package 2 to GitHub Release Assets
1068
- uses: python-semantic-release/publish-action@v10.2.0
1120
+ uses: python-semantic-release/publish-action@v10.3.0
1069
1121
  if: steps.release-submod-2.outputs.released == 'true'
1070
1122
  with:
1071
1123
  directory: ${{ env.SUBMODULE_2_DIR }}
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
6
6
 
7
7
  [project]
8
8
  name = "python-semantic-release"
9
- version = "10.2.0"
9
+ version = "10.3.0"
10
10
  description = "Automatic Semantic Versioning for Python projects"
11
11
  requires-python = ">=3.8"
12
12
  license = { text = "MIT" }
@@ -30,6 +30,7 @@ from semantic_release.errors import (
30
30
  )
31
31
  from semantic_release.gitproject import GitProject
32
32
  from semantic_release.globals import logger
33
+ from semantic_release.hvcs.github import Github
33
34
  from semantic_release.hvcs.remote_hvcs_base import RemoteHvcsBase
34
35
  from semantic_release.version.algorithm import (
35
36
  next_version,
@@ -466,7 +467,12 @@ def version( # noqa: C901
466
467
  major_on_zero = runtime.major_on_zero
467
468
  no_verify = runtime.no_git_verify
468
469
  opts = runtime.global_cli_options
469
- gha_output = VersionGitHubActionsOutput(released=False)
470
+ gha_output = VersionGitHubActionsOutput(
471
+ hvcs_client
472
+ if isinstance(hvcs_client, Github)
473
+ else Github(hvcs_client.remote_url(use_token=False)),
474
+ released=False,
475
+ )
470
476
 
471
477
  forced_level_bump = None if not force_level else LevelBump.from_string(force_level)
472
478
  prerelease = is_forced_prerelease(
@@ -572,6 +578,12 @@ def version( # noqa: C901
572
578
  if print_only or print_only_tag:
573
579
  return
574
580
 
581
+ # TODO: need a better way as this is inconsistent if releasing older version patches
582
+ if last_release := last_released(config.repo_dir, tag_format=config.tag_format):
583
+ # If we have a last release, we can set the previous version for the
584
+ # GitHub Actions output
585
+ gha_output.prev_version = last_release[1]
586
+
575
587
  with Repo(str(runtime.repo_dir)) as git_repo:
576
588
  release_history = ReleaseHistory.from_git_history(
577
589
  repo=git_repo,
@@ -641,6 +653,29 @@ def version( # noqa: C901
641
653
  click.echo("Build failed, aborting release", err=True)
642
654
  ctx.exit(1)
643
655
 
656
+ license_cfg = runtime.project_metadata.get(
657
+ "license-expression",
658
+ runtime.project_metadata.get(
659
+ "license",
660
+ "",
661
+ ),
662
+ )
663
+
664
+ license_cfg = "" if not isinstance(license_cfg, (str, dict)) else license_cfg
665
+ license_cfg = (
666
+ license_cfg.get("text", "") if isinstance(license_cfg, dict) else license_cfg
667
+ )
668
+
669
+ gha_output.release_notes = release_notes = generate_release_notes(
670
+ hvcs_client,
671
+ release=release_history.released[new_version],
672
+ template_dir=runtime.template_dir,
673
+ history=release_history,
674
+ style=runtime.changelog_style,
675
+ mask_initial_release=runtime.changelog_mask_initial_release,
676
+ license_name="" if not isinstance(license_cfg, str) else license_cfg,
677
+ )
678
+
644
679
  project = GitProject(
645
680
  directory=runtime.repo_dir,
646
681
  commit_author=runtime.commit_author,
@@ -676,6 +711,9 @@ def version( # noqa: C901
676
711
  noop=opts.noop,
677
712
  )
678
713
 
714
+ with Repo(str(runtime.repo_dir)) as git_repo:
715
+ gha_output.commit_sha = git_repo.head.commit.hexsha
716
+
679
717
  if push_changes:
680
718
  remote_url = runtime.hvcs_client.remote_url(
681
719
  use_token=not runtime.ignore_token_for_push
@@ -710,33 +748,6 @@ def version( # noqa: C901
710
748
  logger.info("Remote does not support releases. Skipping release creation...")
711
749
  return
712
750
 
713
- license_cfg = runtime.project_metadata.get(
714
- "license-expression",
715
- runtime.project_metadata.get(
716
- "license",
717
- "",
718
- ),
719
- )
720
-
721
- if not isinstance(license_cfg, (str, dict)) or license_cfg is None:
722
- license_cfg = ""
723
-
724
- license_name = (
725
- license_cfg.get("text", "")
726
- if isinstance(license_cfg, dict)
727
- else license_cfg or ""
728
- )
729
-
730
- release_notes = generate_release_notes(
731
- hvcs_client,
732
- release=release_history.released[new_version],
733
- template_dir=runtime.template_dir,
734
- history=release_history,
735
- style=runtime.changelog_style,
736
- mask_initial_release=runtime.changelog_mask_initial_release,
737
- license_name=license_name,
738
- )
739
-
740
751
  exception: Exception | None = None
741
752
  help_message = ""
742
753
  try:
@@ -0,0 +1,150 @@
1
+ from __future__ import annotations
2
+
3
+ import os
4
+ from re import compile as regexp
5
+ from typing import TYPE_CHECKING
6
+
7
+ from semantic_release.globals import logger
8
+ from semantic_release.version.version import Version
9
+
10
+ if TYPE_CHECKING:
11
+ from typing import Any
12
+
13
+ from semantic_release.hvcs.github import Github
14
+
15
+
16
+ class VersionGitHubActionsOutput:
17
+ OUTPUT_ENV_VAR = "GITHUB_OUTPUT"
18
+
19
+ def __init__(
20
+ self,
21
+ gh_client: Github,
22
+ released: bool | None = None,
23
+ version: Version | None = None,
24
+ commit_sha: str | None = None,
25
+ release_notes: str | None = None,
26
+ prev_version: Version | None = None,
27
+ ) -> None:
28
+ self._gh_client = gh_client
29
+ self._released = released
30
+ self._version = version
31
+ self._commit_sha = commit_sha
32
+ self._release_notes = release_notes
33
+ self._prev_version = prev_version
34
+
35
+ @property
36
+ def released(self) -> bool | None:
37
+ return self._released
38
+
39
+ @released.setter
40
+ def released(self, value: bool) -> None:
41
+ if not isinstance(value, bool):
42
+ raise TypeError("output 'released' is boolean")
43
+ self._released = value
44
+
45
+ @property
46
+ def version(self) -> Version | None:
47
+ return self._version if self._version is not None else None
48
+
49
+ @version.setter
50
+ def version(self, value: Version) -> None:
51
+ if not isinstance(value, Version):
52
+ raise TypeError("output 'released' should be a Version")
53
+ self._version = value
54
+
55
+ @property
56
+ def tag(self) -> str | None:
57
+ return self.version.as_tag() if self.version is not None else None
58
+
59
+ @property
60
+ def is_prerelease(self) -> bool | None:
61
+ return self.version.is_prerelease if self.version is not None else None
62
+
63
+ @property
64
+ def commit_sha(self) -> str | None:
65
+ return self._commit_sha if self._commit_sha else None
66
+
67
+ @commit_sha.setter
68
+ def commit_sha(self, value: str) -> None:
69
+ if not isinstance(value, str):
70
+ raise TypeError("output 'commit_sha' should be a string")
71
+
72
+ if not regexp(r"^[0-9a-f]{40}$").match(value):
73
+ raise ValueError(
74
+ "output 'commit_sha' should be a valid 40-hex-character SHA"
75
+ )
76
+
77
+ self._commit_sha = value
78
+
79
+ @property
80
+ def release_notes(self) -> str | None:
81
+ return self._release_notes if self._release_notes else None
82
+
83
+ @release_notes.setter
84
+ def release_notes(self, value: str) -> None:
85
+ if not isinstance(value, str):
86
+ raise TypeError("output 'release_notes' should be a string")
87
+ self._release_notes = value
88
+
89
+ @property
90
+ def prev_version(self) -> Version | None:
91
+ if not self.released:
92
+ return self.version
93
+ return self._prev_version if self._prev_version else None
94
+
95
+ @prev_version.setter
96
+ def prev_version(self, value: Version) -> None:
97
+ if not isinstance(value, Version):
98
+ raise TypeError("output 'prev_version' should be a Version")
99
+ self._prev_version = value
100
+
101
+ def to_output_text(self) -> str:
102
+ missing: set[str] = set()
103
+ if self.version is None:
104
+ missing.add("version")
105
+ if self.released is None:
106
+ missing.add("released")
107
+ if self.released and self.commit_sha is None:
108
+ missing.add("commit_sha")
109
+ if self.released and self.release_notes is None:
110
+ missing.add("release_notes")
111
+
112
+ if missing:
113
+ raise ValueError(
114
+ f"some required outputs were not set: {', '.join(missing)}"
115
+ )
116
+
117
+ output_values: dict[str, Any] = {
118
+ "released": str(self.released).lower(),
119
+ "version": str(self.version),
120
+ "tag": self.tag,
121
+ "is_prerelease": str(self.is_prerelease).lower(),
122
+ "link": self._gh_client.create_release_url(self.tag) if self.tag else "",
123
+ "previous_version": str(self.prev_version) if self.prev_version else "",
124
+ "commit_sha": self.commit_sha if self.commit_sha else "",
125
+ }
126
+
127
+ multiline_output_values: dict[str, str] = {
128
+ "release_notes": self.release_notes if self.release_notes else "",
129
+ }
130
+
131
+ output_lines = [
132
+ *[f"{key}={value!s}{os.linesep}" for key, value in output_values.items()],
133
+ *[
134
+ f"{key}<<EOF{os.linesep}{value}EOF{os.linesep}"
135
+ if value
136
+ else f"{key}={os.linesep}"
137
+ for key, value in multiline_output_values.items()
138
+ ],
139
+ ]
140
+
141
+ return str.join("", output_lines)
142
+
143
+ def write_if_possible(self, filename: str | None = None) -> None:
144
+ output_file = filename or os.getenv(self.OUTPUT_ENV_VAR)
145
+ if not output_file:
146
+ logger.info("not writing GitHub Actions output, as no file specified")
147
+ return
148
+
149
+ with open(output_file, "ab") as f:
150
+ f.write(self.to_output_text().encode("utf-8"))
@@ -9,6 +9,7 @@ from textwrap import dedent, indent
9
9
  from typing import Any
10
10
 
11
11
  import rich
12
+ import rich.markup
12
13
  import tomlkit
13
14
  from tomlkit.exceptions import TOMLKitError
14
15
 
@@ -26,8 +27,7 @@ def noop_report(msg: str) -> None:
26
27
  Rich-prints a msg with a standard prefix to report when an action is not being
27
28
  taken due to a "noop" flag
28
29
  """
29
- fullmsg = "[bold cyan][:shield: NOP] " + msg
30
- rprint(fullmsg)
30
+ rprint(f"[bold cyan][:shield: NOP] {rich.markup.escape(msg)}")
31
31
 
32
32
 
33
33
  def indented(msg: str, prefix: str = " " * 4) -> str:
@@ -0,0 +1,123 @@
1
+ from __future__ import annotations
2
+
3
+ import os
4
+ from datetime import timezone
5
+ from typing import TYPE_CHECKING, cast
6
+
7
+ import pytest
8
+ from freezegun import freeze_time
9
+ from pytest_lazy_fixtures.lazy_fixture import lf as lazy_fixture
10
+
11
+ from semantic_release.version.version import Version
12
+
13
+ from tests.const import EXAMPLE_PROJECT_LICENSE, MAIN_PROG_NAME, VERSION_SUBCMD
14
+ from tests.fixtures.repos import (
15
+ repo_w_git_flow_w_alpha_prereleases_n_conventional_commits,
16
+ )
17
+ from tests.util import actions_output_to_dict, assert_successful_exit_code
18
+
19
+ if TYPE_CHECKING:
20
+ from semantic_release.hvcs.github import Github
21
+
22
+ from tests.conftest import GetStableDateNowFn, RunCliFn
23
+ from tests.fixtures.example_project import ExProjectDir
24
+ from tests.fixtures.git_repo import (
25
+ BuiltRepoResult,
26
+ GenerateDefaultReleaseNotesFromDefFn,
27
+ GetCfgValueFromDefFn,
28
+ GetHvcsClientFromRepoDefFn,
29
+ GetVersionsFromRepoBuildDefFn,
30
+ SplitRepoActionsByReleaseTagsFn,
31
+ )
32
+
33
+
34
+ @pytest.mark.parametrize(
35
+ "repo_result",
36
+ [lazy_fixture(repo_w_git_flow_w_alpha_prereleases_n_conventional_commits.__name__)],
37
+ )
38
+ def test_version_writes_github_actions_output(
39
+ repo_result: BuiltRepoResult,
40
+ run_cli: RunCliFn,
41
+ example_project_dir: ExProjectDir,
42
+ get_cfg_value_from_def: GetCfgValueFromDefFn,
43
+ get_hvcs_client_from_repo_def: GetHvcsClientFromRepoDefFn,
44
+ generate_default_release_notes_from_def: GenerateDefaultReleaseNotesFromDefFn,
45
+ split_repo_actions_by_release_tags: SplitRepoActionsByReleaseTagsFn,
46
+ get_versions_from_repo_build_def: GetVersionsFromRepoBuildDefFn,
47
+ stable_now_date: GetStableDateNowFn,
48
+ ):
49
+ mock_output_file = example_project_dir / "action.out"
50
+ repo_def = repo_result["definition"]
51
+ tag_format_str = cast(str, get_cfg_value_from_def(repo_def, "tag_format_str"))
52
+ all_versions = get_versions_from_repo_build_def(repo_def)
53
+ latest_release_version = all_versions[-1]
54
+ release_tag = tag_format_str.format(version=latest_release_version)
55
+ previous_version = (
56
+ Version.parse(all_versions[-2]) if len(all_versions) > 1 else None
57
+ )
58
+ hvcs_client = cast("Github", get_hvcs_client_from_repo_def(repo_def))
59
+ repo_actions_per_version = split_repo_actions_by_release_tags(
60
+ repo_definition=repo_def,
61
+ tag_format_str=tag_format_str,
62
+ )
63
+ expected_gha_output = {
64
+ "released": str(True).lower(),
65
+ "version": latest_release_version,
66
+ "tag": release_tag,
67
+ "link": hvcs_client.create_release_url(release_tag),
68
+ "commit_sha": "0" * 40,
69
+ "is_prerelease": str(
70
+ Version.parse(latest_release_version).is_prerelease
71
+ ).lower(),
72
+ "previous_version": str(previous_version) if previous_version else "",
73
+ "release_notes": generate_default_release_notes_from_def(
74
+ version_actions=repo_actions_per_version[release_tag],
75
+ hvcs=hvcs_client,
76
+ previous_version=previous_version,
77
+ license_name=EXAMPLE_PROJECT_LICENSE,
78
+ mask_initial_release=get_cfg_value_from_def(
79
+ repo_def, "mask_initial_release"
80
+ ),
81
+ ),
82
+ }
83
+
84
+ # Remove the previous tag & version commit
85
+ repo_result["repo"].git.tag(release_tag, delete=True)
86
+ repo_result["repo"].git.reset("HEAD~1", hard=True)
87
+
88
+ # Act
89
+ with freeze_time(stable_now_date().astimezone(timezone.utc)):
90
+ cli_cmd = [MAIN_PROG_NAME, VERSION_SUBCMD, "--no-push"]
91
+ result = run_cli(
92
+ cli_cmd[1:], env={"GITHUB_OUTPUT": str(mock_output_file.resolve())}
93
+ )
94
+
95
+ assert_successful_exit_code(result, cli_cmd)
96
+
97
+ # Update the expected output with the commit SHA
98
+ expected_gha_output["commit_sha"] = repo_result["repo"].head.commit.hexsha
99
+
100
+ if not mock_output_file.exists():
101
+ pytest.fail(
102
+ f"Expected output file {mock_output_file} to be created, but it does not exist."
103
+ )
104
+
105
+ # Extract the output
106
+ with open(mock_output_file, encoding="utf-8", newline=os.linesep) as rfd:
107
+ action_outputs = actions_output_to_dict(rfd.read())
108
+
109
+ # Evaluate
110
+ expected_keys = set(expected_gha_output.keys())
111
+ actual_keys = set(action_outputs.keys())
112
+ key_difference = expected_keys.symmetric_difference(actual_keys)
113
+
114
+ assert not key_difference, f"Unexpected keys found: {key_difference}"
115
+
116
+ assert expected_gha_output["released"] == action_outputs["released"]
117
+ assert expected_gha_output["version"] == action_outputs["version"]
118
+ assert expected_gha_output["tag"] == action_outputs["tag"]
119
+ assert expected_gha_output["is_prerelease"] == action_outputs["is_prerelease"]
120
+ assert expected_gha_output["link"] == action_outputs["link"]
121
+ assert expected_gha_output["previous_version"] == action_outputs["previous_version"]
122
+ assert expected_gha_output["commit_sha"] == action_outputs["commit_sha"]
123
+ assert expected_gha_output["release_notes"] == action_outputs["release_notes"]