Skip to content

Commit 0e35d88

Browse files
authored
chore: migrate to python-semantic-release8 (#420)
Signed-off-by: Jan Kowalleck <[email protected]>
1 parent adf5a36 commit 0e35d88

File tree

2 files changed

+49
-35
lines changed

2 files changed

+49
-35
lines changed

.github/workflows/release.yml

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,37 @@
11
name: Release
22

33
on:
4-
#push:
5-
# branches: [ 'main' ]
4+
push:
5+
branches: [ 'main', 'master' ]
66
workflow_dispatch:
7-
release_force:
8-
# see https://python-semantic-release.readthedocs.io/en/latest/github-action.html#command-line-options
9-
description: 'force release be one of: [major | minor | patch]'
10-
type: choice
11-
options:
12-
- major
13-
- minor
14-
- patch
15-
default: ""
16-
required: false
17-
prerelease_token:
18-
description: 'The "prerelease identifier" to use as a prefix for the "prerelease" part of a semver. Like the rc in `1.2.0-rc.8`.'
19-
type: choice
20-
options:
21-
- rc
22-
- beta
23-
- alpha
24-
default: rc
25-
required: false
26-
prerelease:
27-
description: "Is a pre-release"
28-
type: boolean
29-
default: false
30-
required: false
7+
inputs:
8+
release_force:
9+
# see https://python-semantic-release.readthedocs.io/en/latest/github-action.html#command-line-options
10+
description: |
11+
Force release be one of: [major | minor | patch]
12+
Leave empty for auto-detect based on commit messages.
13+
type: choice
14+
options:
15+
- "" # auto - no force
16+
- major # force major
17+
- minor # force minor
18+
- patch # force patch
19+
default: ""
20+
required: false
21+
prerelease_token:
22+
description: 'The "prerelease identifier" to use as a prefix for the "prerelease" part of a semver. Like the rc in `1.2.0-rc.8`.'
23+
type: choice
24+
options:
25+
- rc
26+
- beta
27+
- alpha
28+
default: rc
29+
required: false
30+
prerelease:
31+
description: "Is a pre-release"
32+
type: boolean
33+
default: false
34+
required: false
3135

3236
concurrency:
3337
group: deploy
@@ -41,9 +45,9 @@ jobs:
4145
release:
4246
# https://github.community/t/how-do-i-specify-job-dependency-running-in-another-workflow/16482
4347
# limit this to being run on regular commits, not the commits that semantic-release will create
44-
if: github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'chore(release):')
48+
# but also allow manual workflow dispatch
49+
if: "!contains(github.event.head_commit.message, 'chore(release):')"
4550
runs-on: ubuntu-latest
46-
concurrency: release
4751
permissions:
4852
# NOTE: this enables trusted publishing.
4953
# See https://github.com/pypa/gh-action-pypi-publish/tree/release/v1#trusted-publishing
@@ -84,7 +88,7 @@ jobs:
8488
with:
8589
github_token: ${{ secrets.GITHUB_TOKEN }}
8690
force: ${{ github.event.inputs.release_force }}
87-
prerelease: ${{ github.event.inputs.prerelease && "true" || "false" }}
91+
prerelease: ${{ github.event.inputs.prerelease }}
8892
prerelease_token: ${{ github.event.inputs.prerelease_token }}
8993

9094
- name: Publish package distributions to PyPI

pyproject.toml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
[build-system]
2+
requires = ["poetry-core>=1.0.0"]
3+
build-backend = "poetry.core.masonry.api"
4+
15
[tool.poetry]
26
name = "cyclonedx-python-lib"
37
version = "4.0.1"
@@ -66,12 +70,18 @@ lxml = ">=4.7.0"
6670
tox = "^3.2.8"
6771
xmldiff = ">=2.4"
6872

69-
[build-system]
70-
requires = ["poetry-core>=1.0.0"]
71-
build-backend = "poetry.core.masonry.api"
72-
7373
[tool.semantic_release]
74-
version_toml = ["pyproject.toml:tool.poetry.version"]
75-
branch = "main"
74+
# see https://python-semantic-release.readthedocs.io/en/latest/configuration.html
75+
commit_message = "chore(release): {version}\n\nAutomatically generated by python-semantic-release"
7676
upload_to_vcs_release = true
7777
build_command = "pip install poetry && poetry build"
78+
version_toml = ["pyproject.toml:tool.poetry.version"]
79+
[tool.semantic_release.changelog]
80+
changelog_file = "CHANGELOG.md"
81+
exclude_commit_patterns = [
82+
"chore\\(release\\):",
83+
]
84+
[tool.semantic_release.branches."alpha"]
85+
match = "(feat|fix|tests|style|docs|chore)"
86+
prerelease = true
87+
prerelease_token = "alpha"

0 commit comments

Comments
 (0)