python-semantic-release 10.2.0__tar.gz → 10.3.1__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.1}/PKG-INFO +3 -3
  2. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/README.rst +2 -2
  3. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/docs/concepts/getting_started.rst +1 -1
  4. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/docs/configuration/automatic-releases/github-actions.rst +67 -7
  5. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/pyproject.toml +1 -1
  6. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/cli/commands/version.py +50 -29
  7. python_semantic_release-10.3.1/src/semantic_release/cli/github_actions_output.py +159 -0
  8. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/cli/util.py +2 -2
  9. python_semantic_release-10.3.1/tests/e2e/cmd_version/test_version_github_actions.py +123 -0
  10. python_semantic_release-10.3.1/tests/unit/semantic_release/cli/test_github_actions_output.py +161 -0
  11. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/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.1}/LICENSE +0 -0
  16. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/MANIFEST.in +0 -0
  17. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/docs/Makefile +0 -0
  18. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/docs/api/commands.rst +0 -0
  19. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/docs/concepts/changelog_templates.rst +0 -0
  20. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/docs/concepts/commit_parsing.rst +0 -0
  21. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/docs/concepts/index.rst +0 -0
  22. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/docs/concepts/installation.rst +0 -0
  23. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/docs/concepts/multibranch_releases.rst +0 -0
  24. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/docs/concepts/strict_mode.rst +0 -0
  25. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/docs/conf.py +0 -0
  26. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/docs/configuration/automatic-releases/cronjobs.rst +0 -0
  27. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/docs/configuration/automatic-releases/index.rst +0 -0
  28. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/docs/configuration/automatic-releases/travis.rst +0 -0
  29. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/docs/configuration/configuration-guides/index.rst +0 -0
  30. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/docs/configuration/configuration-guides/uv_integration.rst +0 -0
  31. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/docs/configuration/configuration.rst +0 -0
  32. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/docs/configuration/index.rst +0 -0
  33. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/docs/contributing/contributing_guide.rst +0 -0
  34. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/docs/contributing/index.rst +0 -0
  35. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/docs/index.rst +0 -0
  36. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/docs/make.bat +0 -0
  37. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/docs/misc/psr_changelog.rst +0 -0
  38. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/docs/misc/troubleshooting.rst +0 -0
  39. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/docs/upgrading/08-upgrade.rst +0 -0
  40. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/docs/upgrading/09-upgrade.rst +0 -0
  41. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/docs/upgrading/10-upgrade.rst +0 -0
  42. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/docs/upgrading/index.rst +0 -0
  43. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/setup.cfg +0 -0
  44. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/python_semantic_release.egg-info/SOURCES.txt +0 -0
  45. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/__init__.py +0 -0
  46. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/__main__.py +0 -0
  47. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/changelog/__init__.py +0 -0
  48. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/changelog/context.py +0 -0
  49. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/changelog/release_history.py +0 -0
  50. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/changelog/template.py +0 -0
  51. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/cli/__init__.py +0 -0
  52. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/cli/changelog_writer.py +0 -0
  53. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/cli/cli_context.py +0 -0
  54. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/cli/commands/__init__.py +0 -0
  55. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/cli/commands/changelog.py +0 -0
  56. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/cli/commands/generate_config.py +0 -0
  57. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/cli/commands/main.py +0 -0
  58. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/cli/commands/publish.py +0 -0
  59. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/cli/config.py +0 -0
  60. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/cli/const.py +0 -0
  61. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/cli/masking_filter.py +0 -0
  62. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/commit_parser/__init__.py +0 -0
  63. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/commit_parser/_base.py +0 -0
  64. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/commit_parser/angular.py +0 -0
  65. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/commit_parser/conventional.py +0 -0
  66. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/commit_parser/emoji.py +0 -0
  67. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/commit_parser/scipy.py +0 -0
  68. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/commit_parser/tag.py +0 -0
  69. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/commit_parser/token.py +0 -0
  70. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/commit_parser/util.py +0 -0
  71. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/const.py +0 -0
  72. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/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.1}/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.1}/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.1}/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.1}/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.1}/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.1}/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.1}/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.1}/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.1}/src/semantic_release/data/templates/conventional/md/CHANGELOG.md.j2 +0 -0
  82. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/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.1}/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.1}/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.1}/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.1}/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.1}/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.1}/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.1}/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.1}/src/semantic_release/data/templates/conventional/rst/CHANGELOG.rst.j2 +0 -0
  91. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/enums.py +0 -0
  92. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/errors.py +0 -0
  93. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/gitproject.py +0 -0
  94. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/globals.py +0 -0
  95. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/helpers.py +0 -0
  96. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/hvcs/__init__.py +0 -0
  97. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/hvcs/_base.py +0 -0
  98. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/hvcs/bitbucket.py +0 -0
  99. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/hvcs/gitea.py +0 -0
  100. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/hvcs/github.py +0 -0
  101. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/hvcs/gitlab.py +0 -0
  102. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/hvcs/remote_hvcs_base.py +0 -0
  103. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/hvcs/token_auth.py +0 -0
  104. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/hvcs/util.py +0 -0
  105. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/py.typed +0 -0
  106. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/version/__init__.py +0 -0
  107. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/version/algorithm.py +0 -0
  108. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/version/declaration.py +0 -0
  109. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/version/declarations/__init__.py +0 -0
  110. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/version/declarations/enum.py +0 -0
  111. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/version/declarations/i_version_replacer.py +0 -0
  112. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/version/declarations/pattern.py +0 -0
  113. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/version/declarations/toml.py +0 -0
  114. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/version/translator.py +0 -0
  115. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/src/semantic_release/version/version.py +0 -0
  116. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/__init__.py +0 -0
  117. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/conftest.py +0 -0
  118. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/const.py +0 -0
  119. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/e2e/__init__.py +0 -0
  120. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/e2e/cmd_changelog/__init__.py +0 -0
  121. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/e2e/cmd_changelog/test_changelog.py +0 -0
  122. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/e2e/cmd_changelog/test_changelog_custom_parser.py +0 -0
  123. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/e2e/cmd_changelog/test_changelog_parsing.py +0 -0
  124. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/e2e/cmd_changelog/test_changelog_release_notes.py +0 -0
  125. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/e2e/cmd_config/__init__.py +0 -0
  126. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/e2e/cmd_config/test_generate_config.py +0 -0
  127. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/e2e/cmd_publish/__init__.py +0 -0
  128. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/e2e/cmd_publish/test_publish.py +0 -0
  129. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/e2e/cmd_version/__init__.py +0 -0
  130. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/e2e/cmd_version/bump_version/__init__.py +0 -0
  131. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/e2e/cmd_version/bump_version/conftest.py +0 -0
  132. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/e2e/cmd_version/bump_version/git_flow/__init__.py +0 -0
  133. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/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.1}/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.1}/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.1}/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.1}/tests/e2e/cmd_version/bump_version/github_flow/__init__.py +0 -0
  138. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/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.1}/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.1}/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.1}/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.1}/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.1}/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.1}/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.1}/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.1}/tests/e2e/cmd_version/test_version.py +0 -0
  147. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/e2e/cmd_version/test_version_build.py +0 -0
  148. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/e2e/cmd_version/test_version_bump.py +0 -0
  149. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/e2e/cmd_version/test_version_changelog.py +0 -0
  150. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/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.1}/tests/e2e/cmd_version/test_version_print.py +0 -0
  152. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/e2e/cmd_version/test_version_release_notes.py +0 -0
  153. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/e2e/cmd_version/test_version_stamp.py +0 -0
  154. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/e2e/cmd_version/test_version_strict.py +0 -0
  155. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/e2e/conftest.py +0 -0
  156. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/e2e/test_help.py +0 -0
  157. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/e2e/test_main.py +0 -0
  158. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/fixtures/__init__.py +0 -0
  159. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/fixtures/commit_parsers.py +0 -0
  160. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/fixtures/example_project.py +0 -0
  161. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/fixtures/git_repo.py +0 -0
  162. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/fixtures/repos/__init__.py +0 -0
  163. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/fixtures/repos/git_flow/__init__.py +0 -0
  164. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/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.1}/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.1}/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.1}/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.1}/tests/fixtures/repos/github_flow/__init__.py +0 -0
  169. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/fixtures/repos/github_flow/repo_w_default_release.py +0 -0
  170. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/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.1}/tests/fixtures/repos/github_flow/repo_w_release_channels.py +0 -0
  172. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/fixtures/repos/repo_initial_commit.py +0 -0
  173. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/fixtures/repos/trunk_based_dev/__init__.py +0 -0
  174. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/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.1}/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.1}/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.1}/tests/fixtures/repos/trunk_based_dev/repo_w_prereleases.py +0 -0
  178. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/fixtures/repos/trunk_based_dev/repo_w_tags.py +0 -0
  179. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/fixtures/scipy.py +0 -0
  180. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/__init__.py +0 -0
  181. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/conftest.py +0 -0
  182. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/__init__.py +0 -0
  183. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/changelog/__init__.py +0 -0
  184. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/changelog/conftest.py +0 -0
  185. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/changelog/test_changelog_context.py +0 -0
  186. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/changelog/test_default_changelog.py +0 -0
  187. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/changelog/test_release_history.py +0 -0
  188. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/changelog/test_release_notes.py +0 -0
  189. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/changelog/test_template.py +0 -0
  190. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/changelog/test_template_render.py +0 -0
  191. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/cli/__init__.py +0 -0
  192. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/cli/test_config.py +0 -0
  193. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/cli/test_masking_filter.py +0 -0
  194. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/cli/test_util.py +0 -0
  195. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/cli/test_version.py +0 -0
  196. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/commit_parser/__init__.py +0 -0
  197. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/commit_parser/test_conventional.py +0 -0
  198. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/commit_parser/test_emoji.py +0 -0
  199. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/commit_parser/test_parsed_commit.py +0 -0
  200. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/commit_parser/test_scipy.py +0 -0
  201. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/commit_parser/test_util.py +0 -0
  202. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/hvcs/__init__.py +0 -0
  203. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/hvcs/test__base.py +0 -0
  204. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/hvcs/test_bitbucket.py +0 -0
  205. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/hvcs/test_gitea.py +0 -0
  206. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/hvcs/test_github.py +0 -0
  207. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/hvcs/test_gitlab.py +0 -0
  208. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/hvcs/test_token_auth.py +0 -0
  209. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/hvcs/test_util.py +0 -0
  210. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/test_helpers.py +0 -0
  211. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/version/__init__.py +0 -0
  212. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/version/declarations/__init__.py +0 -0
  213. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/version/declarations/test_pattern_declaration.py +0 -0
  214. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/version/declarations/test_toml_declaration.py +0 -0
  215. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/version/test_algorithm.py +0 -0
  216. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/tests/unit/semantic_release/version/test_translator.py +0 -0
  217. {python_semantic_release-10.2.0 → python_semantic_release-10.3.1}/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.1
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(?:\([^)]*?\))?: .+''',
@@ -19,6 +19,14 @@ There are two official GitHub Actions for Python Semantic Release:
19
19
  It is used to upload files, such as distribution artifacts and other assets,
20
20
  to a GitHub release.
21
21
 
22
+ Included in this documentation are some recommended examples below if you want to get
23
+ started quickly. These examples are not exhaustive and you will need to adjust them
24
+ for your specific project needs especially if you are using a monorepo.
25
+
26
+ - :ref:`GitHub Actions Example Workflows <gh_actions-examples>`
27
+
28
+ - :ref:`GitHub Actions with Monorepos <gh_actions-monorepo>`
29
+
22
30
  .. note::
23
31
  These GitHub Actions are only simplified wrappers around the
24
32
  python-semantic-release CLI. Ultimately, they download and install the
@@ -513,6 +521,20 @@ and any actions that were taken.
513
521
 
514
522
  ----
515
523
 
524
+ .. _gh_actions-psr-outputs-commit_sha:
525
+
526
+ ``commit_sha``
527
+ """"""""""""""
528
+
529
+ **Type:** ``string``
530
+
531
+ The commit SHA of the release if a release was made, otherwise an empty string.
532
+
533
+ Example upon release: ``d4c3b2a1e0f9c8b7a6e5d4c3b2a1e0f9c8b7a6e5``
534
+ Example when no release was made: ``""``
535
+
536
+ ----
537
+
516
538
  .. _gh_actions-psr-outputs-is_prerelease:
517
539
 
518
540
  ``is_prerelease``
@@ -524,6 +546,32 @@ A boolean value indicating whether the released version is a prerelease.
524
546
 
525
547
  ----
526
548
 
549
+ .. _gh_actions-psr-outputs-link:
550
+
551
+ ``link``
552
+ """"""""
553
+
554
+ **Type:** ``string``
555
+
556
+ The URL link to the release if a release was made, otherwise an empty string.
557
+
558
+ Example upon release: ``https://github.com/user/repo/releases/tag/v1.2.3``
559
+ Example when no release was made: ``""``
560
+
561
+ ----
562
+
563
+ .. _gh_actions-psr-outputs-previous_version:
564
+
565
+ ``previous_version``
566
+ """"""""""""""""""""
567
+
568
+ **Type:** ``string``
569
+
570
+ The previous version before the release, if a release was or will be made. If no release is detected,
571
+ this will be the current version or an empty string if no previous version exists.
572
+
573
+ ----
574
+
527
575
  .. _gh_actions-psr-outputs-released:
528
576
 
529
577
  ``released``
@@ -535,6 +583,18 @@ A boolean value indicating whether a release was made.
535
583
 
536
584
  ----
537
585
 
586
+ .. _gh_actions-psr-outputs-release_notes:
587
+
588
+ ``release_notes``
589
+ """""""""""""""""""
590
+
591
+ **Type:** ``string``
592
+
593
+ The release notes generated by the release, if any. If no release was made,
594
+ this will be an empty string.
595
+
596
+ ----
597
+
538
598
  .. _gh_actions-psr-outputs-version:
539
599
 
540
600
  ``version``
@@ -873,14 +933,14 @@ to the GitHub Release Assets as well.
873
933
  - name: Action | Semantic Version Release
874
934
  id: release
875
935
  # Adjust tag with desired version if applicable.
876
- uses: python-semantic-release/python-semantic-release@v10.2.0
936
+ uses: python-semantic-release/python-semantic-release@v10.3.1
877
937
  with:
878
938
  github_token: ${{ secrets.GITHUB_TOKEN }}
879
939
  git_committer_name: "github-actions"
880
940
  git_committer_email: "actions@users.noreply.github.com"
881
941
 
882
942
  - name: Publish | Upload to GitHub Release Assets
883
- uses: python-semantic-release/publish-action@v10.2.0
943
+ uses: python-semantic-release/publish-action@v10.3.1
884
944
  if: steps.release.outputs.released == 'true'
885
945
  with:
886
946
  github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -979,7 +1039,7 @@ The equivalent GitHub Action configuration would be:
979
1039
 
980
1040
  - name: Action | Semantic Version Release
981
1041
  # Adjust tag with desired version if applicable.
982
- uses: python-semantic-release/python-semantic-release@v10.2.0
1042
+ uses: python-semantic-release/python-semantic-release@v10.3.1
983
1043
  with:
984
1044
  github_token: ${{ secrets.GITHUB_TOKEN }}
985
1045
  force: patch
@@ -1038,14 +1098,14 @@ Publish Action.
1038
1098
 
1039
1099
  - name: Release submodule 1
1040
1100
  id: release-submod-1
1041
- uses: python-semantic-release/python-semantic-release@v10.2.0
1101
+ uses: python-semantic-release/python-semantic-release@v10.3.1
1042
1102
  with:
1043
1103
  directory: ${{ env.SUBMODULE_1_DIR }}
1044
1104
  github_token: ${{ secrets.GITHUB_TOKEN }}
1045
1105
 
1046
1106
  - name: Release submodule 2
1047
1107
  id: release-submod-2
1048
- uses: python-semantic-release/python-semantic-release@v10.2.0
1108
+ uses: python-semantic-release/python-semantic-release@v10.3.1
1049
1109
  with:
1050
1110
  directory: ${{ env.SUBMODULE_2_DIR }}
1051
1111
  github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -1057,7 +1117,7 @@ Publish Action.
1057
1117
  # ------------------------------------------------------------------- #
1058
1118
 
1059
1119
  - name: Publish | Upload package 1 to GitHub Release Assets
1060
- uses: python-semantic-release/publish-action@v10.2.0
1120
+ uses: python-semantic-release/publish-action@v10.3.1
1061
1121
  if: steps.release-submod-1.outputs.released == 'true'
1062
1122
  with:
1063
1123
  directory: ${{ env.SUBMODULE_1_DIR }}
@@ -1065,7 +1125,7 @@ Publish Action.
1065
1125
  tag: ${{ steps.release-submod-1.outputs.tag }}
1066
1126
 
1067
1127
  - name: Publish | Upload package 2 to GitHub Release Assets
1068
- uses: python-semantic-release/publish-action@v10.2.0
1128
+ uses: python-semantic-release/publish-action@v10.3.1
1069
1129
  if: steps.release-submod-2.outputs.released == 'true'
1070
1130
  with:
1071
1131
  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.1"
10
10
  description = "Automatic Semantic Versioning for Python projects"
11
11
  requires-python = ">=3.8"
12
12
  license = { text = "MIT" }
@@ -18,7 +18,10 @@ from semantic_release.cli.changelog_writer import (
18
18
  generate_release_notes,
19
19
  write_changelog_files,
20
20
  )
21
- from semantic_release.cli.github_actions_output import VersionGitHubActionsOutput
21
+ from semantic_release.cli.github_actions_output import (
22
+ PersistenceMode,
23
+ VersionGitHubActionsOutput,
24
+ )
22
25
  from semantic_release.cli.util import noop_report, rprint
23
26
  from semantic_release.const import DEFAULT_SHELL, DEFAULT_VERSION
24
27
  from semantic_release.enums import LevelBump
@@ -30,6 +33,7 @@ from semantic_release.errors import (
30
33
  )
31
34
  from semantic_release.gitproject import GitProject
32
35
  from semantic_release.globals import logger
36
+ from semantic_release.hvcs.github import Github
33
37
  from semantic_release.hvcs.remote_hvcs_base import RemoteHvcsBase
34
38
  from semantic_release.version.algorithm import (
35
39
  next_version,
@@ -466,7 +470,19 @@ def version( # noqa: C901
466
470
  major_on_zero = runtime.major_on_zero
467
471
  no_verify = runtime.no_git_verify
468
472
  opts = runtime.global_cli_options
469
- gha_output = VersionGitHubActionsOutput(released=False)
473
+ gha_output = VersionGitHubActionsOutput(
474
+ gh_client=(
475
+ hvcs_client
476
+ if isinstance(hvcs_client, Github)
477
+ else Github(hvcs_client.remote_url(use_token=False))
478
+ ),
479
+ mode=(
480
+ PersistenceMode.TEMPORARY
481
+ if opts.noop or (not commit_changes and not create_tag)
482
+ else PersistenceMode.PERMANENT
483
+ ),
484
+ released=False,
485
+ )
470
486
 
471
487
  forced_level_bump = None if not force_level else LevelBump.from_string(force_level)
472
488
  prerelease = is_forced_prerelease(
@@ -572,6 +588,12 @@ def version( # noqa: C901
572
588
  if print_only or print_only_tag:
573
589
  return
574
590
 
591
+ # TODO: need a better way as this is inconsistent if releasing older version patches
592
+ if last_release := last_released(config.repo_dir, tag_format=config.tag_format):
593
+ # If we have a last release, we can set the previous version for the
594
+ # GitHub Actions output
595
+ gha_output.prev_version = last_release[1]
596
+
575
597
  with Repo(str(runtime.repo_dir)) as git_repo:
576
598
  release_history = ReleaseHistory.from_git_history(
577
599
  repo=git_repo,
@@ -641,6 +663,29 @@ def version( # noqa: C901
641
663
  click.echo("Build failed, aborting release", err=True)
642
664
  ctx.exit(1)
643
665
 
666
+ license_cfg = runtime.project_metadata.get(
667
+ "license-expression",
668
+ runtime.project_metadata.get(
669
+ "license",
670
+ "",
671
+ ),
672
+ )
673
+
674
+ license_cfg = "" if not isinstance(license_cfg, (str, dict)) else license_cfg
675
+ license_cfg = (
676
+ license_cfg.get("text", "") if isinstance(license_cfg, dict) else license_cfg
677
+ )
678
+
679
+ gha_output.release_notes = release_notes = generate_release_notes(
680
+ hvcs_client,
681
+ release=release_history.released[new_version],
682
+ template_dir=runtime.template_dir,
683
+ history=release_history,
684
+ style=runtime.changelog_style,
685
+ mask_initial_release=runtime.changelog_mask_initial_release,
686
+ license_name="" if not isinstance(license_cfg, str) else license_cfg,
687
+ )
688
+
644
689
  project = GitProject(
645
690
  directory=runtime.repo_dir,
646
691
  commit_author=runtime.commit_author,
@@ -676,6 +721,9 @@ def version( # noqa: C901
676
721
  noop=opts.noop,
677
722
  )
678
723
 
724
+ with Repo(str(runtime.repo_dir)) as git_repo:
725
+ gha_output.commit_sha = git_repo.head.commit.hexsha
726
+
679
727
  if push_changes:
680
728
  remote_url = runtime.hvcs_client.remote_url(
681
729
  use_token=not runtime.ignore_token_for_push
@@ -710,33 +758,6 @@ def version( # noqa: C901
710
758
  logger.info("Remote does not support releases. Skipping release creation...")
711
759
  return
712
760
 
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
761
  exception: Exception | None = None
741
762
  help_message = ""
742
763
  try:
@@ -0,0 +1,159 @@
1
+ from __future__ import annotations
2
+
3
+ import os
4
+ from enum import Enum
5
+ from re import compile as regexp
6
+ from typing import TYPE_CHECKING
7
+
8
+ from semantic_release.globals import logger
9
+ from semantic_release.version.version import Version
10
+
11
+ if TYPE_CHECKING:
12
+ from typing import Any
13
+
14
+ from semantic_release.hvcs.github import Github
15
+
16
+
17
+ class PersistenceMode(Enum):
18
+ TEMPORARY = "temporary"
19
+ PERMANENT = "permanent"
20
+
21
+
22
+ class VersionGitHubActionsOutput:
23
+ OUTPUT_ENV_VAR = "GITHUB_OUTPUT"
24
+
25
+ def __init__(
26
+ self,
27
+ gh_client: Github,
28
+ mode: PersistenceMode = PersistenceMode.PERMANENT,
29
+ released: bool | None = None,
30
+ version: Version | None = None,
31
+ commit_sha: str | None = None,
32
+ release_notes: str | None = None,
33
+ prev_version: Version | None = None,
34
+ ) -> None:
35
+ self._gh_client = gh_client
36
+ self._mode = mode
37
+ self._released = released
38
+ self._version = version
39
+ self._commit_sha = commit_sha
40
+ self._release_notes = release_notes
41
+ self._prev_version = prev_version
42
+
43
+ @property
44
+ def released(self) -> bool | None:
45
+ return self._released
46
+
47
+ @released.setter
48
+ def released(self, value: bool) -> None:
49
+ if not isinstance(value, bool):
50
+ raise TypeError("output 'released' is boolean")
51
+ self._released = value
52
+
53
+ @property
54
+ def version(self) -> Version | None:
55
+ return self._version if self._version is not None else None
56
+
57
+ @version.setter
58
+ def version(self, value: Version) -> None:
59
+ if not isinstance(value, Version):
60
+ raise TypeError("output 'released' should be a Version")
61
+ self._version = value
62
+
63
+ @property
64
+ def tag(self) -> str | None:
65
+ return self.version.as_tag() if self.version is not None else None
66
+
67
+ @property
68
+ def is_prerelease(self) -> bool | None:
69
+ return self.version.is_prerelease if self.version is not None else None
70
+
71
+ @property
72
+ def commit_sha(self) -> str | None:
73
+ return self._commit_sha if self._commit_sha else None
74
+
75
+ @commit_sha.setter
76
+ def commit_sha(self, value: str) -> None:
77
+ if not isinstance(value, str):
78
+ raise TypeError("output 'commit_sha' should be a string")
79
+
80
+ if not regexp(r"^[0-9a-f]{40}$").match(value):
81
+ raise ValueError(
82
+ "output 'commit_sha' should be a valid 40-hex-character SHA"
83
+ )
84
+
85
+ self._commit_sha = value
86
+
87
+ @property
88
+ def release_notes(self) -> str | None:
89
+ return self._release_notes if self._release_notes else None
90
+
91
+ @release_notes.setter
92
+ def release_notes(self, value: str) -> None:
93
+ if not isinstance(value, str):
94
+ raise TypeError("output 'release_notes' should be a string")
95
+ self._release_notes = value
96
+
97
+ @property
98
+ def prev_version(self) -> Version | None:
99
+ if not self.released:
100
+ return self.version
101
+ return self._prev_version if self._prev_version else None
102
+
103
+ @prev_version.setter
104
+ def prev_version(self, value: Version) -> None:
105
+ if not isinstance(value, Version):
106
+ raise TypeError("output 'prev_version' should be a Version")
107
+ self._prev_version = value
108
+
109
+ def to_output_text(self) -> str:
110
+ missing: set[str] = set()
111
+ if self.version is None:
112
+ missing.add("version")
113
+ if self.released is None:
114
+ missing.add("released")
115
+ if self.released:
116
+ if self.release_notes is None:
117
+ missing.add("release_notes")
118
+ if self._mode is PersistenceMode.PERMANENT and self.commit_sha is None:
119
+ missing.add("commit_sha")
120
+
121
+ if missing:
122
+ raise ValueError(
123
+ f"some required outputs were not set: {', '.join(missing)}"
124
+ )
125
+
126
+ output_values: dict[str, Any] = {
127
+ "released": str(self.released).lower(),
128
+ "version": str(self.version),
129
+ "tag": self.tag,
130
+ "is_prerelease": str(self.is_prerelease).lower(),
131
+ "link": self._gh_client.create_release_url(self.tag) if self.tag else "",
132
+ "previous_version": str(self.prev_version) if self.prev_version else "",
133
+ "commit_sha": self.commit_sha if self.commit_sha else "",
134
+ }
135
+
136
+ multiline_output_values: dict[str, str] = {
137
+ "release_notes": self.release_notes if self.release_notes else "",
138
+ }
139
+
140
+ output_lines = [
141
+ *[f"{key}={value!s}{os.linesep}" for key, value in output_values.items()],
142
+ *[
143
+ f"{key}<<EOF{os.linesep}{value}EOF{os.linesep}"
144
+ if value
145
+ else f"{key}={os.linesep}"
146
+ for key, value in multiline_output_values.items()
147
+ ],
148
+ ]
149
+
150
+ return str.join("", output_lines)
151
+
152
+ def write_if_possible(self, filename: str | None = None) -> None:
153
+ output_file = filename or os.getenv(self.OUTPUT_ENV_VAR)
154
+ if not output_file:
155
+ logger.info("not writing GitHub Actions output, as no file specified")
156
+ return
157
+
158
+ with open(output_file, "ab") as f:
159
+ 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"]