Skip to content

Commit

Permalink
feat: add cliff generate changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkgos committed Jan 30, 2024
1 parent d74d126 commit a936fa0
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 8 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,22 @@ jobs:
needs: [github_build]
runs-on: ubuntu-latest
steps:
- name: Generate a changelog
uses: orhun/git-cliff-action@v2
with:
config: cliff.toml
args: --latest
env:
OUTPUT: CHANGELOG.md

- name: Setup | Artifacts
uses: actions/download-artifact@v4

- name: Setup | Checksums
run: for file in goup-*/goup-*; do openssl dgst -sha256 -r "$file" | awk '{print $1}' > "${file}.sha256"; done

- name: Build | Add Artifacts to Release
uses: softprops/action-gh-release@v1
with:
body_path: CHANGELOG.md
files: goup-*/goup-*
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ members = [
default-members = ["goup"]

[workspace.package]
version = "0.4.0"
version = "0.5.0"
authors = ["thinkgo <[email protected]>"]
edition = "2021"
rust-version = "1.70.0"
Expand Down
82 changes: 82 additions & 0 deletions cliff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# git-cliff ~ default configuration file
# https://git-cliff.org/docs/configuration
#
# Lines starting with "#" are comments.
# Configuration options are organized into tables and keys.
# See documentation for more information on available options.

[changelog]
# changelog header
header = """
# Changelog\n
"""
# template for the changelog body
# https://keats.github.io/tera/docs/#introduction
body = """
{% if version %}\
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
{% else %}\
## [unreleased]
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | upper_first }}
{% for commit in commits %}
- {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\
{% endfor %}
{% endfor %}\n
"""
# remove the leading and trailing whitespace from the template
trim = true
# changelog footer
footer = """
<!-- generated by git-cliff -->
"""
# postprocessors
postprocessors = [
# { pattern = '<REPO>', replace = "https://github.com/orhun/git-cliff" }, # replace repository URL
]
[git]
# parse the commits based on https://www.conventionalcommits.org
conventional_commits = true
# filter out the commits that are not conventional
filter_unconventional = true
# process each line of a commit as an individual commit
split_commits = false
# regex for preprocessing the commit messages
commit_preprocessors = [
# { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))"}, # replace issue numbers
]
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^feat", group = "Features" },
{ message = "^fix", group = "Bug Fixes" },
{ message = "^doc", group = "Documentation" },
{ message = "^perf", group = "Performance" },
{ message = "^refactor", group = "Refactor" },
{ message = "^style", group = "Styling" },
{ message = "^test", group = "Testing" },
{ message = "^chore\\(release\\): prepare for", skip = true },
{ message = "^chore\\(deps\\)", skip = true },
{ message = "^chore\\(pr\\)", skip = true },
{ message = "^chore\\(pull\\)", skip = true },
{ message = "^chore|ci", group = "Miscellaneous Tasks" },
{ body = ".*security", group = "Security" },
{ message = "^revert", group = "Revert" },
]
# protect breaking changes from being skipped due to matching a skipping commit_parser
protect_breaking_commits = false
# filter out the commits that are not matched by commit parsers
filter_commits = false
# regex for matching git tags
tag_pattern = "v[0-9].*"

# regex for skipping tags
skip_tags = "v0.1.0-beta.1"
# regex for ignoring tags
ignore_tags = ""
# sort the tags topologically
topo_order = false
# sort the commits inside sections by oldest/newest order
sort_commits = "oldest"
# limit the number of commits included in the changelog.
# limit_commits = 42
2 changes: 1 addition & 1 deletion goup-downloader/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repository.workspace =true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
goup-version = {path = "../goup-version", version = "0.4"}
goup-version = {path = "../goup-version", version = "0.5"}
anyhow = "1.0"
dirs = "5.0"
regex = "1.10"
Expand Down
4 changes: 2 additions & 2 deletions goup/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ version_check = "0.9"
shadow-rs = "0.26"

[dependencies]
goup-version = {path = "../goup-version", version = "0.4"}
goup-downloader = {path = "../goup-downloader", version = "0.4"}
goup-version = {path = "../goup-version", version = "0.5"}
goup-downloader = {path = "../goup-downloader", version = "0.5"}

clap = {version = "4.4", features = ["derive", "env"]}
clap_complete = "4.4"
Expand Down

0 comments on commit a936fa0

Please sign in to comment.