Skip to content

Commit 4de7701

Browse files
pehlicdKeep Release Botshahargl
authored
feat(ci): add semantic version releasing mechanism (#1039)
Co-authored-by: Keep Release Bot <no-reply@keephq.dev> Co-authored-by: Shahar Glazner <shaharglazner@gmail.com>
1 parent 0e485e6 commit 4de7701

File tree

4 files changed

+112
-0
lines changed

4 files changed

+112
-0
lines changed

.github/workflows/release.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Keep Release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
release:
8+
runs-on: ubuntu-latest
9+
concurrency: release
10+
permissions:
11+
id-token: write
12+
contents: write
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
persist-credentials: false
19+
20+
- name: Release Keep
21+
uses: python-semantic-release/python-semantic-release@v9.4.0
22+
env:
23+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
with:
25+
git_committer_name: Keep Release Bot
26+
git_committer_email: no-reply@keephq.dev
27+
github_token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,10 @@ keep.yaml
172172
providers.yaml
173173
.vercel
174174
keepstate.json
175+
175176
# keep single tenant id
176177
e1faa321-35df-486b-8fa8-3601ee714011*
178+
177179
# sqlite db
178180
*.sqlite3
179181
state/*

CHANGELOG.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# CHANGELOG
2+
{% if context.history.unreleased | length > 0 %}
3+
4+
{# UNRELEASED #}
5+
## Unreleased
6+
{% for type_, commits in context.history.unreleased | dictsort %}
7+
### {{ type_ | capitalize }}
8+
{% for commit in commits %}{% if type_ != "unknown" %}
9+
* {{ commit.commit.message.rstrip() }} ([`{{ commit.commit.hexsha[:7] }}`]({{ commit.commit.hexsha | commit_hash_url }}))
10+
{% else %}
11+
* {{ commit.commit.message.rstrip() }} ([`{{ commit.commit.hexsha[:7] }}`]({{ commit.commit.hexsha | commit_hash_url }}))
12+
{% endif %}{% endfor %}{% endfor %}
13+
14+
{% endif %}
15+
16+
{# RELEASED #}
17+
{% for version, release in context.history.released.items() %}
18+
## {{ version.as_tag() }} ({{ release.tagged_date.strftime("%Y-%m-%d") }})
19+
{% for type_, commits in release["elements"] | dictsort %}
20+
### {{ type_ | capitalize }}
21+
{% for commit in commits %}{% if type_ != "unknown" %}
22+
* {{ commit.commit.message.rstrip() }} ([`{{ commit.commit.hexsha[:7] }}`]({{ commit.commit.hexsha | commit_hash_url }}))
23+
{% else %}
24+
* {{ commit.commit.message.rstrip() }} ([`{{ commit.commit.hexsha[:7] }}`]({{ commit.commit.hexsha | commit_hash_url }}))
25+
{% endif %}{% endfor %}{% endfor %}{% endfor %}

pyproject.toml

+58
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,61 @@ keep = "keep.cli.cli:cli"
104104

105105
[tool.ruff.lint]
106106
ignore = ["F405", "F811", "E712", "E711", "F403"]
107+
108+
[tool.semantic_release]
109+
assets = []
110+
commit_message = "{version}\n\n Released new version of the Keep"
111+
commit_parser = "angular"
112+
logging_use_named_masks = false
113+
major_on_zero = true
114+
allow_zero_version = true
115+
tag_format = "v{version}"
116+
version_toml = [
117+
"pyproject.toml:tool.poetry.version",
118+
]
119+
120+
[tool.semantic_release.branches.main]
121+
match = "(main|master)"
122+
prerelease_token = "rc"
123+
prerelease = false
124+
125+
[tool.semantic_release.changelog]
126+
template_dir = "./"
127+
changelog_file = "CHANGELOG.md"
128+
exclude_commit_patterns = []
129+
130+
[tool.semantic_release.changelog.environment]
131+
block_start_string = "{%"
132+
block_end_string = "%}"
133+
variable_start_string = "{{"
134+
variable_end_string = "}}"
135+
comment_start_string = "{#"
136+
comment_end_string = "#}"
137+
trim_blocks = false
138+
lstrip_blocks = false
139+
newline_sequence = "\n"
140+
keep_trailing_newline = false
141+
extensions = []
142+
autoescape = true
143+
144+
[tool.semantic_release.commit_author]
145+
env = "GIT_COMMIT_AUTHOR"
146+
default = "semantic-release <semantic-release>"
147+
148+
[tool.semantic_release.commit_parser_options]
149+
allowed_tags = ["build", "chore", "ci", "docs", "feat", "fix", "perf", "style", "refactor", "test"]
150+
minor_tags = ["feat"]
151+
patch_tags = ["fix", "perf"]
152+
default_bump_level = 0
153+
154+
[tool.semantic_release.remote]
155+
name = "origin"
156+
type = "github"
157+
ignore_token_for_push = false
158+
159+
[tool.semantic_release.remote.token]
160+
env = "GH_TOKEN"
161+
162+
[tool.semantic_release.publish]
163+
dist_glob_patterns = ["dist/*"]
164+
upload_to_vcs_release = true

0 commit comments

Comments
 (0)