diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3e9bb45..9384e49 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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-* \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 0170415..c0741b2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -754,7 +754,7 @@ dependencies = [ [[package]] name = "goup-downloader" -version = "0.4.0" +version = "0.5.0" dependencies = [ "anyhow", "dirs", @@ -770,7 +770,7 @@ dependencies = [ [[package]] name = "goup-rs" -version = "0.4.0" +version = "0.5.0" dependencies = [ "anyhow", "clap", @@ -789,7 +789,7 @@ dependencies = [ [[package]] name = "goup-version" -version = "0.4.0" +version = "0.5.0" dependencies = [ "anyhow", "dirs", diff --git a/Cargo.toml b/Cargo.toml index 2189867..c05ef77 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ members = [ default-members = ["goup"] [workspace.package] -version = "0.4.0" +version = "0.5.0" authors = ["thinkgo "] edition = "2021" rust-version = "1.70.0" diff --git a/cliff.toml b/cliff.toml new file mode 100644 index 0000000..d1dbd6c --- /dev/null +++ b/cliff.toml @@ -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 = """ + +""" +# postprocessors +postprocessors = [ + # { pattern = '', 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}](/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 diff --git a/goup-downloader/Cargo.toml b/goup-downloader/Cargo.toml index b23aabd..5e73e17 100644 --- a/goup-downloader/Cargo.toml +++ b/goup-downloader/Cargo.toml @@ -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" diff --git a/goup/Cargo.toml b/goup/Cargo.toml index 067c44a..25920d7 100644 --- a/goup/Cargo.toml +++ b/goup/Cargo.toml @@ -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"