winipedia-utils 0.3.24__tar.gz → 0.3.28__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.

Potentially problematic release.


This version of winipedia-utils might be problematic. Click here for more details.

Files changed (90) hide show
  1. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/PKG-INFO +1 -19
  2. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/README.md +0 -18
  3. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/pyproject.toml +1 -1
  4. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/git/workflows/base/base.py +74 -2
  5. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/git/workflows/publish.py +16 -24
  6. winipedia_utils-0.3.28/winipedia_utils/git/workflows/pullrequest.py +44 -0
  7. winipedia_utils-0.3.28/winipedia_utils/git/workflows/release.py +43 -0
  8. winipedia_utils-0.3.24/winipedia_utils/git/workflows/release.py +0 -71
  9. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/LICENSE +0 -0
  10. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/__init__.py +0 -0
  11. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/concurrent/__init__.py +0 -0
  12. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/concurrent/concurrent.py +0 -0
  13. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/concurrent/multiprocessing.py +0 -0
  14. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/concurrent/multithreading.py +0 -0
  15. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/data/__init__.py +0 -0
  16. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/data/dataframe/__init__.py +0 -0
  17. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/data/dataframe/cleaning.py +0 -0
  18. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/data/structures/__init__.py +0 -0
  19. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/data/structures/dicts.py +0 -0
  20. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/git/__init__.py +0 -0
  21. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/git/gitignore/__init__.py +0 -0
  22. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/git/gitignore/config.py +0 -0
  23. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/git/gitignore/gitignore.py +0 -0
  24. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/git/pre_commit/__init__.py +0 -0
  25. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/git/pre_commit/config.py +0 -0
  26. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/git/pre_commit/hooks.py +0 -0
  27. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/git/pre_commit/run_hooks.py +0 -0
  28. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/git/workflows/__init__.py +0 -0
  29. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/git/workflows/base/__init__.py +0 -0
  30. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/iterating/__init__.py +0 -0
  31. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/iterating/iterate.py +0 -0
  32. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/logging/__init__.py +0 -0
  33. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/logging/ansi.py +0 -0
  34. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/logging/config.py +0 -0
  35. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/logging/logger.py +0 -0
  36. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/modules/__init__.py +0 -0
  37. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/modules/class_.py +0 -0
  38. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/modules/function.py +0 -0
  39. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/modules/module.py +0 -0
  40. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/modules/package.py +0 -0
  41. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/oop/__init__.py +0 -0
  42. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/oop/mixins/__init__.py +0 -0
  43. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/oop/mixins/meta.py +0 -0
  44. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/oop/mixins/mixin.py +0 -0
  45. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/os/__init__.py +0 -0
  46. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/os/os.py +0 -0
  47. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/projects/__init__.py +0 -0
  48. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/projects/poetry/__init__.py +0 -0
  49. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/projects/poetry/config.py +0 -0
  50. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/projects/poetry/poetry.py +0 -0
  51. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/projects/project.py +0 -0
  52. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/py.typed +0 -0
  53. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/resources/__init__.py +0 -0
  54. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/resources/svgs/__init__.py +0 -0
  55. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/resources/svgs/delete_garbage_can.svg +0 -0
  56. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/resources/svgs/download_arrow.svg +0 -0
  57. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/resources/svgs/exit_fullscreen_icon.svg +0 -0
  58. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/resources/svgs/fullscreen_icon.svg +0 -0
  59. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/resources/svgs/menu_icon.svg +0 -0
  60. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/resources/svgs/pause_icon.svg +0 -0
  61. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/resources/svgs/play_icon.svg +0 -0
  62. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/resources/svgs/plus_icon.svg +0 -0
  63. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/resources/svgs/svg.py +0 -0
  64. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/security/__init__.py +0 -0
  65. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/security/cryptography.py +0 -0
  66. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/security/keyring.py +0 -0
  67. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/setup.py +0 -0
  68. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/testing/__init__.py +0 -0
  69. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/testing/assertions.py +0 -0
  70. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/testing/config.py +0 -0
  71. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/testing/convention.py +0 -0
  72. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/testing/create_tests.py +0 -0
  73. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/testing/fixtures.py +0 -0
  74. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/testing/skip.py +0 -0
  75. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/testing/tests/__init__.py +0 -0
  76. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/testing/tests/base/__init__.py +0 -0
  77. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/testing/tests/base/fixtures/__init__.py +0 -0
  78. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/testing/tests/base/fixtures/fixture.py +0 -0
  79. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/testing/tests/base/fixtures/scopes/__init__.py +0 -0
  80. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/testing/tests/base/fixtures/scopes/class_.py +0 -0
  81. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/testing/tests/base/fixtures/scopes/function.py +0 -0
  82. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/testing/tests/base/fixtures/scopes/module.py +0 -0
  83. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/testing/tests/base/fixtures/scopes/package.py +0 -0
  84. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/testing/tests/base/fixtures/scopes/session.py +0 -0
  85. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/testing/tests/base/utils/__init__.py +0 -0
  86. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/testing/tests/base/utils/utils.py +0 -0
  87. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/testing/tests/conftest.py +0 -0
  88. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/text/__init__.py +0 -0
  89. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/text/config.py +0 -0
  90. {winipedia_utils-0.3.24 → winipedia_utils-0.3.28}/winipedia_utils/text/string.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: winipedia-utils
3
- Version: 0.3.24
3
+ Version: 0.3.28
4
4
  Summary: A package with many utility functions
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE
@@ -251,7 +251,6 @@ String manipulation and configuration file handling:
251
251
 
252
252
  ```python
253
253
  from winipedia_utils.text.string import value_to_truncated_string
254
- from winipedia_utils.text.config import ConfigFile
255
254
  ```
256
255
 
257
256
  ### OS and System Utilities
@@ -270,23 +269,6 @@ Utilities for working with iterables and nested structures:
270
269
  from winipedia_utils.iterating.iterate import get_len_with_default, nested_structure_is_subset
271
270
  ```
272
271
 
273
- ### Git Utilities
274
-
275
- Git-related utilities including .gitignore handling and pre-commit hooks:
276
-
277
- ```python
278
- from winipedia_utils.git.gitignore.gitignore import path_is_in_gitignore
279
- ```
280
-
281
- ### Project Management Utilities
282
-
283
- Tools for managing Poetry projects and project structure:
284
-
285
- ```python
286
- from winipedia_utils.projects.project import create_project_root
287
- from winipedia_utils.projects.poetry.config import PyProjectTomlConfig
288
- ```
289
-
290
272
  ### Philosophy
291
273
 
292
274
  The core philosophy of Winipedia Utils is to:
@@ -227,7 +227,6 @@ String manipulation and configuration file handling:
227
227
 
228
228
  ```python
229
229
  from winipedia_utils.text.string import value_to_truncated_string
230
- from winipedia_utils.text.config import ConfigFile
231
230
  ```
232
231
 
233
232
  ### OS and System Utilities
@@ -246,23 +245,6 @@ Utilities for working with iterables and nested structures:
246
245
  from winipedia_utils.iterating.iterate import get_len_with_default, nested_structure_is_subset
247
246
  ```
248
247
 
249
- ### Git Utilities
250
-
251
- Git-related utilities including .gitignore handling and pre-commit hooks:
252
-
253
- ```python
254
- from winipedia_utils.git.gitignore.gitignore import path_is_in_gitignore
255
- ```
256
-
257
- ### Project Management Utilities
258
-
259
- Tools for managing Poetry projects and project structure:
260
-
261
- ```python
262
- from winipedia_utils.projects.project import create_project_root
263
- from winipedia_utils.projects.poetry.config import PyProjectTomlConfig
264
- ```
265
-
266
248
  ### Philosophy
267
249
 
268
250
  The core philosophy of Winipedia Utils is to:
@@ -1,7 +1,7 @@
1
1
  # Project section
2
2
  [project]
3
3
  name = "winipedia-utils"
4
- version = "0.3.24"
4
+ version = "0.3.28"
5
5
  description = "A package with many utility functions"
6
6
  readme = "README.md"
7
7
  requires-python = ">=3.12"
@@ -1,6 +1,7 @@
1
1
  """Contains base utilities for git workflows."""
2
2
 
3
3
  from abc import abstractmethod
4
+ from pathlib import Path
4
5
  from typing import Any
5
6
 
6
7
  from winipedia_utils.text.config import YamlConfigFile
@@ -22,6 +23,34 @@ class Workflow(YamlConfigFile):
22
23
  def get_jobs(self) -> dict[str, Any]:
23
24
  """Get the workflow jobs."""
24
25
 
26
+ def get_path(self) -> Path:
27
+ """Get the path to the config file."""
28
+ return (
29
+ Path(".github/workflows")
30
+ / f"{self.__class__.__name__.lower().removesuffix('workflow')}.yaml"
31
+ )
32
+
33
+ @staticmethod
34
+ def get_standard_job(
35
+ name: str,
36
+ steps: list[dict[str, Any]],
37
+ permissions: dict[str, Any] | None = None,
38
+ if_condition: str | None = None,
39
+ ) -> dict[str, Any]:
40
+ """Get a standard job."""
41
+ job: dict[str, Any] = {
42
+ name: {
43
+ "runs-on": "ubuntu-latest",
44
+ "steps": steps,
45
+ }
46
+ }
47
+ if permissions is not None:
48
+ job[name]["permissions"] = permissions
49
+
50
+ if if_condition is not None:
51
+ job[name]["if"] = if_condition
52
+ return job
53
+
25
54
  @classmethod
26
55
  def get_workflow_name(cls) -> str:
27
56
  """Get the workflow name."""
@@ -53,7 +82,7 @@ class Workflow(YamlConfigFile):
53
82
  """
54
83
  step: dict[str, Any] = {
55
84
  "name": "Checkout repository",
56
- "uses": "actions/checkout@v5",
85
+ "uses": "actions/checkout@main",
57
86
  }
58
87
  if fetch_depth is not None:
59
88
  step["with"] = {"fetch-depth": fetch_depth}
@@ -93,7 +122,7 @@ class Workflow(YamlConfigFile):
93
122
  steps.append(
94
123
  {
95
124
  "name": "Setup Python",
96
- "uses": "actions/setup-python@v6",
125
+ "uses": "actions/setup-python@main",
97
126
  "with": {"python-version": "3.x"},
98
127
  }
99
128
  )
@@ -121,6 +150,49 @@ class Workflow(YamlConfigFile):
121
150
  steps.append({"name": "Install Dependencies", "run": "poetry install"})
122
151
  return steps
123
152
 
153
+ @staticmethod
154
+ def get_release_steps() -> list[dict[str, Any]]:
155
+ """Get the release steps."""
156
+ return [
157
+ {
158
+ "name": "Create and Push Tag",
159
+ "run": f"git tag {Workflow.get_version()} && git push origin {Workflow.get_version()}", # noqa: E501
160
+ },
161
+ {
162
+ "name": "Build Changelog",
163
+ "id": "build_changelog",
164
+ "uses": "mikepenz/release-changelog-builder-action@develop",
165
+ "with": {"token": "${{ secrets.GITHUB_TOKEN }}"},
166
+ },
167
+ {
168
+ "name": "Create GitHub Release",
169
+ "uses": "ncipollo/release-action@main",
170
+ "with": {
171
+ "tag": Workflow.get_version(),
172
+ "name": Workflow.get_repo_and_version(),
173
+ "body": "${{ steps.build_changelog.outputs.changelog }}",
174
+ },
175
+ },
176
+ ]
177
+
178
+ @staticmethod
179
+ def get_publish_to_pypi_step() -> dict[str, Any]:
180
+ """Get the publish step."""
181
+ return {"name": "Build and publish to PyPI", "run": "poetry publish --build"}
182
+
183
+ @staticmethod
184
+ def get_pre_commit_step() -> dict[str, Any]:
185
+ """Get the pre-commit step.
186
+
187
+ using pre commit in case other hooks are added later
188
+ and bc it fails if files are changed,
189
+ setup script shouldnt change files
190
+ """
191
+ return {
192
+ "name": "Run Hooks",
193
+ "run": "poetry run pre-commit run --all-files --verbose",
194
+ }
195
+
124
196
  @staticmethod
125
197
  def get_repository_name() -> str:
126
198
  """Get the repository name."""
@@ -3,7 +3,6 @@
3
3
  This workflow is used to publish the package to PyPI with poetry.
4
4
  """
5
5
 
6
- from pathlib import Path
7
6
  from typing import Any
8
7
 
9
8
  from winipedia_utils.git.workflows.base.base import Workflow
@@ -11,13 +10,11 @@ from winipedia_utils.git.workflows.release import ReleaseWorkflow
11
10
 
12
11
 
13
12
  class PublishWorkflow(Workflow):
14
- """Publish workflow."""
13
+ """Publish workflow.
15
14
 
16
- PATH = Path(".github/workflows/publish.yaml")
17
-
18
- def get_path(self) -> Path:
19
- """Get the path to the config file."""
20
- return self.PATH
15
+ This workflow is triggered by the release workflow.
16
+ It publishes the package to PyPI with poetry.
17
+ """
21
18
 
22
19
  def get_workflow_triggers(self) -> dict[str, Any]:
23
20
  """Get the workflow triggers."""
@@ -36,20 +33,15 @@ class PublishWorkflow(Workflow):
36
33
 
37
34
  def get_jobs(self) -> dict[str, Any]:
38
35
  """Get the workflow jobs."""
39
- return {
40
- "publish": {
41
- "runs-on": "ubuntu-latest",
42
- "if": "${{ github.event.workflow_run.conclusion == 'success' }}",
43
- "steps": [
44
- *(
45
- self.get_poetry_setup_steps(
46
- configure_pipy_token=True,
47
- )
48
- ),
49
- {
50
- "name": "Build and publish to PyPI",
51
- "run": "poetry publish --build",
52
- },
53
- ],
54
- }
55
- }
36
+ return self.get_standard_job(
37
+ "publish",
38
+ steps=[
39
+ *(
40
+ self.get_poetry_setup_steps(
41
+ configure_pipy_token=True,
42
+ )
43
+ ),
44
+ self.get_publish_to_pypi_step(),
45
+ ],
46
+ if_condition="${{ github.event.workflow_run.conclusion == 'success' }}",
47
+ )
@@ -0,0 +1,44 @@
1
+ """Contains the pull request workflow.
2
+
3
+ This workflow is used to run tests on pull requests.
4
+ """
5
+
6
+ from typing import Any
7
+
8
+ from winipedia_utils.git.workflows.base.base import Workflow
9
+
10
+
11
+ class PullRequestWorkflow(Workflow):
12
+ """Pull request workflow.
13
+
14
+ This workflow is triggered by a pull request.
15
+ It runs tests on the pull request.
16
+ """
17
+
18
+ def get_workflow_triggers(self) -> dict[str, Any]:
19
+ """Get the workflow triggers."""
20
+ return {
21
+ "pull_request": {
22
+ "types": ["opened", "synchronize", "reopened"],
23
+ },
24
+ }
25
+
26
+ def get_permissions(self) -> dict[str, Any]:
27
+ """Get the workflow permissions."""
28
+ return {
29
+ "contents": "read",
30
+ }
31
+
32
+ def get_jobs(self) -> dict[str, Any]:
33
+ """Get the workflow jobs."""
34
+ return self.get_standard_job(
35
+ "check pull request",
36
+ steps=[
37
+ *(
38
+ self.get_poetry_setup_steps(
39
+ install_dependencies=True,
40
+ )
41
+ ),
42
+ self.get_pre_commit_step(),
43
+ ],
44
+ )
@@ -0,0 +1,43 @@
1
+ """Contains the release workflow.
2
+
3
+ This workflow is used to create a release on GitHub.
4
+ """
5
+
6
+ from typing import Any
7
+
8
+ from winipedia_utils.git.workflows.base.base import Workflow
9
+
10
+
11
+ class ReleaseWorkflow(Workflow):
12
+ """Release workflow.
13
+
14
+ This workflow is triggered by a push to the main branch.
15
+ It creates a tag for the release and builds a changelog.
16
+ With tag and changelog it creates a release on GitHub
17
+ """
18
+
19
+ def get_workflow_triggers(self) -> dict[str, Any]:
20
+ """Get the workflow triggers."""
21
+ return {"push": {"branches": ["main"]}}
22
+
23
+ def get_permissions(self) -> dict[str, Any]:
24
+ """Get the workflow permissions."""
25
+ return {
26
+ "contents": "write",
27
+ }
28
+
29
+ def get_jobs(self) -> dict[str, Any]:
30
+ """Get the workflow jobs."""
31
+ return self.get_standard_job(
32
+ "release",
33
+ steps=[
34
+ *(
35
+ self.get_poetry_setup_steps(
36
+ install_dependencies=True,
37
+ fetch_depth=0,
38
+ )
39
+ ),
40
+ self.get_pre_commit_step(),
41
+ *self.get_release_steps(),
42
+ ],
43
+ )
@@ -1,71 +0,0 @@
1
- """Contains the release workflow.
2
-
3
- This workflow is used to create a release on GitHub.
4
- """
5
-
6
- from pathlib import Path
7
- from typing import Any
8
-
9
- from winipedia_utils.git.workflows.base.base import Workflow
10
-
11
-
12
- class ReleaseWorkflow(Workflow):
13
- """Release workflow."""
14
-
15
- PATH = Path(".github/workflows/release.yaml")
16
-
17
- def get_path(self) -> Path:
18
- """Get the path to the config file."""
19
- return self.PATH
20
-
21
- def get_workflow_triggers(self) -> dict[str, Any]:
22
- """Get the workflow triggers."""
23
- return {"push": {"branches": ["main"]}}
24
-
25
- def get_permissions(self) -> dict[str, Any]:
26
- """Get the workflow permissions."""
27
- return {
28
- "contents": "write",
29
- }
30
-
31
- def get_jobs(self) -> dict[str, Any]:
32
- """Get the workflow jobs."""
33
- return {
34
- "release": {
35
- "runs-on": "ubuntu-latest",
36
- "steps": [
37
- *(
38
- self.get_poetry_setup_steps(
39
- install_dependencies=True,
40
- fetch_depth=0,
41
- )
42
- ),
43
- {
44
- # using pre commit in case other hooks are added later
45
- # and bc it fails if files are changed,
46
- # setup script shouldnt change files
47
- "name": "Run Hooks",
48
- "run": "poetry run pre-commit run --all-files --verbose",
49
- },
50
- {
51
- "name": "Create and Push Tag",
52
- "run": f"git tag {self.get_version()} && git push origin {self.get_version()}", # noqa: E501
53
- },
54
- {
55
- "name": "Build Changelog",
56
- "id": "build_changelog",
57
- "uses": "mikepenz/release-changelog-builder-action@v5",
58
- "with": {"token": "${{ secrets.GITHUB_TOKEN }}"},
59
- },
60
- {
61
- "name": "Create GitHub Release",
62
- "uses": "ncipollo/release-action@v1",
63
- "with": {
64
- "tag": self.get_version(),
65
- "name": self.get_repo_and_version(),
66
- "body": "${{ steps.build_changelog.outputs.changelog }}",
67
- },
68
- },
69
- ],
70
- }
71
- }