Skip to content

Commit 95002cb

Browse files
authored
Merge pull request #31 from sandialabs/semantic-release
ci: Set up semantice-release
2 parents 2829f55 + b7b369e commit 95002cb

File tree

5 files changed

+92
-1
lines changed

5 files changed

+92
-1
lines changed

.github/workflows/ci.yml renamed to .github/workflows/continuous-integration.yml

+8
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,11 @@ jobs:
5151
- name: Test uninstall
5252
run: |
5353
python3 -m pip uninstall -y reverse_argparse
54+
55+
commits:
56+
runs-on: ubuntu-latest
57+
steps:
58+
- name: Conventional Commits
59+
uses: taskmedia/[email protected]
60+
with:
61+
types: "build|chore|ci|docs|feat|fix|perf|style|refactor|test"
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Semantic Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
concurrency: release
12+
permissions:
13+
id-token: write
14+
contents: write
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0
20+
token: ${{ secrets.GH_TOKEN }}
21+
22+
- name: Python Semantic Release
23+
uses: python-semantic-release/python-semantic-release@master
24+
with:
25+
github_token: ${{ secrets.GH_TOKEN }}

pyproject.toml

+29-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ classifiers = [
5050
"Topic :: Software Development :: Debuggers",
5151
"Topic :: Software Development :: Documentation",
5252
"Topic :: Software Development :: User Interfaces",
53-
"Typing :: Typed"
53+
"Typing :: Typed",
5454
]
5555

5656

@@ -66,3 +66,31 @@ python = ">=3.8"
6666
[tool.poetry.dev-dependencies]
6767
# At some point, convert from the various requirements.txt files to this
6868
# list of Poetry development dependencies.
69+
70+
71+
[tool.semantic_release]
72+
commit_message = """
73+
{version}
74+
75+
Automatically generated by python-semantic-release."""
76+
version_variables = [
77+
"doc/source/conf.py:version",
78+
]
79+
version_toml = [
80+
"pyproject.toml:tool.poetry.version",
81+
]
82+
83+
84+
[tool.semantic_release.branches.master]
85+
match = "master"
86+
87+
88+
[tool.semantic_release.changelog]
89+
exclude_commit_patterns = [
90+
"Merge pull request",
91+
]
92+
93+
94+
[tool.semantic_release.commit_author]
95+
env = "GIT_COMMIT_AUTHOR"
96+
default = "semantic-release <semantic-release>"

reverse_argparse/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
from .reverse_argparse import ReverseArgumentParser, quote_arg_if_necessary
88

99
__all__ = ["ReverseArgumentParser", "quote_arg_if_necessary"]
10+
__version__ = "1.0.0"

templates/CHANGELOG.md.j2

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

0 commit comments

Comments
 (0)