autopub 1.0.0a3__tar.gz → 1.0.0a5__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: autopub
3
- Version: 1.0.0a3
3
+ Version: 1.0.0a5
4
4
  Summary: Automatic package release upon pull request merge
5
5
  Home-page: https://github.com/autopub/autopub
6
6
  License: AGPL-3.0
@@ -44,7 +44,6 @@ class Autopub:
44
44
  def release_data_file(self) -> Path:
45
45
  return Path(".autopub") / "release_data.json"
46
46
 
47
- # TODO: typed dict
48
47
  @property
49
48
  def release_data(self) -> ReleaseInfo:
50
49
  if not self.release_data_file.exists():
@@ -95,6 +94,16 @@ class Autopub:
95
94
  for plugin in self.plugins:
96
95
  plugin.prepare(self.release_data)
97
96
 
97
+ self._write_artifact(self.release_data)
98
+
99
+ for plugin in self.plugins:
100
+ plugin.post_prepare(self.release_data)
101
+
102
+ self._write_artifact(self.release_data)
103
+
104
+ def _delete_release_file(self) -> None:
105
+ self.release_file.unlink()
106
+
98
107
  def publish(self, repository: str | None = None) -> None:
99
108
  # TODO: shall we put this in a function, to make it
100
109
  # clear that we are triggering the logic to check the release file?
@@ -104,6 +113,11 @@ class Autopub:
104
113
  if isinstance(plugin, AutopubPackageManagerPlugin):
105
114
  plugin.publish(repository=repository)
106
115
 
116
+ for plugin in self.plugins:
117
+ plugin.post_publish()
118
+
119
+ self._delete_release_file()
120
+
107
121
  def _write_artifact(self, release_info: ReleaseInfo) -> None:
108
122
  data = {
109
123
  "hash": self.release_file_hash,
@@ -111,7 +111,7 @@ def main(
111
111
  ] = None,
112
112
  ):
113
113
  state["plugins"] = plugins
114
- state["plugins"].extend(["bump_version"])
114
+ state["plugins"].extend(["update_changelog", "bump_version"])
115
115
 
116
116
  if should_show_version:
117
117
  from importlib.metadata import version
@@ -19,6 +19,9 @@ class AutopubPlugin:
19
19
  def prepare(self, release_info: ReleaseInfo) -> None: # pragma: no cover
20
20
  ...
21
21
 
22
+ def post_prepare(self, release_info: ReleaseInfo) -> None: # pragma: no cover
23
+ ...
24
+
22
25
  def validate_release_notes(self, release_info: ReleaseInfo): # pragma: no cover
23
26
  ...
24
27
 
@@ -28,6 +31,9 @@ class AutopubPlugin:
28
31
  def on_release_notes_invalid(self, exception: AutopubException): # pragma: no cover
29
32
  ...
30
33
 
34
+ def post_publish(self) -> None: # pragma: no cover
35
+ ...
36
+
31
37
 
32
38
  @runtime_checkable
33
39
  class AutopubPackageManagerPlugin(Protocol):
@@ -36,6 +36,9 @@ class BumpVersionPlugin(AutopubPlugin):
36
36
  bump_type = {"major": 0, "minor": 1, "patch": 2}[release_info.release_type]
37
37
  new_version = version.bump(bump_type).serialize()
38
38
 
39
+ self.data["old_version"] = version.serialize()
40
+ self.data["new_version"] = new_version
41
+
39
42
  self._update_version(config, new_version)
40
43
 
41
44
  pathlib.Path("pyproject.toml").write_text(tomlkit.dumps(config)) # type: ignore
@@ -17,7 +17,7 @@ class UpdateChangelogPlugin(AutopubPlugin):
17
17
  return Path("CHANGELOG.md")
18
18
 
19
19
  def post_prepare(self, release_info: ReleaseInfo) -> None:
20
- assert release_info.version is not None
20
+ assert release_info.additional_info["new_version"]
21
21
 
22
22
  if not self.changelog_file.exists():
23
23
  self.changelog_file.write_text(f"CHANGELOG\n{CHANGELOG_HEADER}\n\n")
@@ -37,11 +37,13 @@ class UpdateChangelogPlugin(AutopubPlugin):
37
37
  header = lines[: index + 1]
38
38
  break
39
39
 
40
+ new_version = release_info.additional_info["new_version"]
41
+
40
42
  with self.changelog_file.open("w") as f:
41
43
  f.write("\n".join(header))
42
44
  f.write("\n")
43
45
 
44
- new_version_header = f"{release_info.version} - {current_date}"
46
+ new_version_header = f"{new_version} - {current_date}"
45
47
 
46
48
  f.write(f"\n{new_version_header}\n")
47
49
  f.write(f"{VERSION_HEADER * len(new_version_header)}\n\n")
@@ -3,7 +3,7 @@ requires-python = ">=3.8"
3
3
 
4
4
  [tool.poetry]
5
5
  name = "autopub"
6
- version = "1.0.0-alpha.3"
6
+ version = "1.0.0-alpha.5"
7
7
  description = "Automatic package release upon pull request merge"
8
8
  authors = ["Justin Mayer <entroP@gmail.com>", "Patrick Arminio <patrick.arminio@gmail.com>"]
9
9
  license = "AGPL-3.0"
File without changes
File without changes
File without changes
File without changes