Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(actions): Generazione changelog #52

Merged
merged 2 commits into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions .github/workflows/autorelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,23 @@ jobs:
with:
fetch-depth: 0

- name: Generate changelog
uses: orhun/git-cliff-action@v2
id: git-cliff
with:
config: .github/workflows/configs/conf.toml
args: -vv --latest --unreleased --strip header --tag v${{needs.tag.outputs.newtag}}
- name: Install jq
run: sudo apt-get install -y jq

- name: Install git-cliff 🏔
run: |
export version=1.2.0
wget "https://github.com/orhun/git-cliff/releases/download/v${version}/git-cliff-${version}-x86_64-unknown-linux-gnu.tar.gz"
tar -xvzf git-cliff-*.tar.gz
cp "git-cliff-${version}/git-cliff" /usr/local/bin/

- name: Generate a changelog
run: git-cliff -vv --latest --unreleased --strip header --config .github/workflows/conf.toml --tag v${{needs.tag.outputs.newtag}} -o log.md
env:
OUTPUT: CHANGES.md
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Cat Changelog
run: cat ${{ steps.git-cliff.outputs.changelog }}
run: cat log.md

- name: Create Release
uses: actions/create-release@v1
Expand All @@ -51,5 +57,5 @@ jobs:
with:
tag_name: "v${{needs.tag.outputs.newtag}}"
release_name: "v${{needs.tag.outputs.newtag}}"
body: ${{ steps.git-cliff.outputs.content }}
body_path: log.md

9 changes: 5 additions & 4 deletions .github/workflows/configs/conf.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ body = """
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | upper_first }}
{% for commit in commits %}
- {{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}]({{ github_repo_link }}/commit/{{ commit.id }})) by {{ commit.author.name }}\
- {{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}]({{ github_repo_link }}/commit/{{ commit.id }})) \
{% endfor %}
{% endfor %}\n

Expand All @@ -40,9 +40,10 @@ filter_unconventional = false
split_commits = false
# regex for parsing and grouping commits

# commit_preprocessors = [
# {pattern = "username", replace_command="gh api -H 'Accept: application/vnd.github+json' -H 'X-GitHub-Api-Version: 2022-11-28' /repos/ncvescera/provaactions/commits/$COMMIT_SHA | jq -r .author.login"},
# ]
commit_preprocessors = [
{pattern = ".*", replace_command="echo -n \"$(head -1 $@) @$(gh api -H 'Accept: application/vnd.github+json' -H 'X-GitHub-Api-Version: 2022-11-28' /repos/Typing-Monkeys/AppuntiUniversita/commits/$COMMIT_SHA | jq -r .author.login)\""}
]

commit_parsers = [
{ message = "^feat", group = "Features 🚀"},
{ message = "^fix", group = "Fixes 🔨"},
Expand Down