Skip to content

Commit

Permalink
Merge pull request #31 from sandialabs/semantic-release
Browse files Browse the repository at this point in the history
ci: Set up semantice-release
  • Loading branch information
jmgate authored Jul 20, 2023
2 parents 2829f55 + b7b369e commit 95002cb
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,11 @@ jobs:
- name: Test uninstall
run: |
python3 -m pip uninstall -y reverse_argparse
commits:
runs-on: ubuntu-latest
steps:
- name: Conventional Commits
uses: taskmedia/[email protected]
with:
types: "build|chore|ci|docs|feat|fix|perf|style|refactor|test"
25 changes: 25 additions & 0 deletions .github/workflows/semantic-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Semantic Release

on:
push:
branches:
- master

jobs:
release:
runs-on: ubuntu-latest
concurrency: release
permissions:
id-token: write
contents: write

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}

- name: Python Semantic Release
uses: python-semantic-release/python-semantic-release@master
with:
github_token: ${{ secrets.GH_TOKEN }}
30 changes: 29 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ classifiers = [
"Topic :: Software Development :: Debuggers",
"Topic :: Software Development :: Documentation",
"Topic :: Software Development :: User Interfaces",
"Typing :: Typed"
"Typing :: Typed",
]


Expand All @@ -66,3 +66,31 @@ python = ">=3.8"
[tool.poetry.dev-dependencies]
# At some point, convert from the various requirements.txt files to this
# list of Poetry development dependencies.


[tool.semantic_release]
commit_message = """
{version}
Automatically generated by python-semantic-release."""
version_variables = [
"doc/source/conf.py:version",
]
version_toml = [
"pyproject.toml:tool.poetry.version",
]


[tool.semantic_release.branches.master]
match = "master"


[tool.semantic_release.changelog]
exclude_commit_patterns = [
"Merge pull request",
]


[tool.semantic_release.commit_author]
env = "GIT_COMMIT_AUTHOR"
default = "semantic-release <semantic-release>"
1 change: 1 addition & 0 deletions reverse_argparse/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
from .reverse_argparse import ReverseArgumentParser, quote_arg_if_necessary

__all__ = ["ReverseArgumentParser", "quote_arg_if_necessary"]
__version__ = "1.0.0"
29 changes: 29 additions & 0 deletions templates/CHANGELOG.md.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# CHANGELOG


{% if context.history.unreleased | length > 0 %}
## Unreleased
{% for type_, commits in context.history.unreleased | dictsort %}
### {{ type_ | capitalize if type_ != "ci" else "Continuous Integration "}}
{% for commit in commits -%}
{%- set summary = commit.message.rstrip().splitlines()[0] -%}
{%- set details = commit.message.rstrip().splitlines()[2:] -%}
* {{ summary }} ([`{{ commit.hexsha[:7] }}`]({{ commit.hexsha | commit_hash_url }}))
{% if details %}
{% for line in details %}{% if line.strip() %} {{ line }}{% endif %}
{% endfor %}{% endif %}{% endfor -%}
{% endfor %}
{% endif %}

{% for version, release in context.history.released.items() -%}
## {{ version.as_tag() }} ({{ release.tagged_date.strftime("%Y-%m-%d") }})
{% for type_, commits in release["elements"] | dictsort %}
### {{ type_ | capitalize if type_ != "ci" else "Continuous Integration "}}
{% for commit in commits -%}
{%- set summary = commit.message.rstrip().splitlines()[0] -%}
{%- set details = commit.message.rstrip().splitlines()[2:] -%}
* {{ summary }} ([`{{ commit.hexsha[:7] }}`]({{ commit.hexsha | commit_hash_url }}))
{% if details %}
{% for line in details %}{% if line.strip() %} {{ line }}{% endif %}
{% endfor %}{% endif -%}
{% endfor %}{% endfor %}{% endfor %}

0 comments on commit 95002cb

Please sign in to comment.