diff --git a/.github/workflows/autorelease.yml b/.github/workflows/autorelease.yml index 4a2b9938e..9346e9a91 100644 --- a/.github/workflows/autorelease.yml +++ b/.github/workflows/autorelease.yml @@ -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 @@ -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 diff --git a/.github/workflows/configs/conf.toml b/.github/workflows/configs/conf.toml index 9c5689227..27d2fc19a 100644 --- a/.github/workflows/configs/conf.toml +++ b/.github/workflows/configs/conf.toml @@ -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 @@ -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 🔨"},