chore: added git cliff workflow
3a7572cd
2 file(s) · +87 −0
| 9 | 9 | contents: write |
|
| 10 | 10 | ||
| 11 | 11 | jobs: |
|
| 12 | + | changelog: |
|
| 13 | + | name: Generate changelog |
|
| 14 | + | runs-on: ubuntu-latest |
|
| 15 | + | outputs: |
|
| 16 | + | release_notes: ${{ steps.git-cliff.outputs.content }} |
|
| 17 | + | steps: |
|
| 18 | + | - uses: actions/checkout@v4 |
|
| 19 | + | with: |
|
| 20 | + | fetch-depth: 0 |
|
| 21 | + | ||
| 22 | + | - name: Generate release notes |
|
| 23 | + | id: git-cliff |
|
| 24 | + | uses: orhun/git-cliff-action@v4 |
|
| 25 | + | with: |
|
| 26 | + | config: cliff.toml |
|
| 27 | + | args: --verbose --latest --strip header |
|
| 28 | + | env: |
|
| 29 | + | GITHUB_REPO: ${{ github.repository }} |
|
| 30 | + | ||
| 31 | + | - name: Generate full changelog |
|
| 32 | + | uses: orhun/git-cliff-action@v4 |
|
| 33 | + | with: |
|
| 34 | + | config: cliff.toml |
|
| 35 | + | args: --verbose |
|
| 36 | + | env: |
|
| 37 | + | OUTPUT: CHANGELOG.md |
|
| 38 | + | GITHUB_REPO: ${{ github.repository }} |
|
| 39 | + | ||
| 40 | + | - name: Commit changelog |
|
| 41 | + | run: | |
|
| 42 | + | git config user.name "github-actions[bot]" |
|
| 43 | + | git config user.email "github-actions[bot]@users.noreply.github.com" |
|
| 44 | + | git add CHANGELOG.md |
|
| 45 | + | git diff --staged --quiet || git commit -m "chore(release): update CHANGELOG.md for ${{ github.ref_name }}" |
|
| 46 | + | git push origin HEAD:main |
|
| 47 | + | ||
| 12 | 48 | build: |
|
| 13 | 49 | name: Build ${{ matrix.target }} |
|
| 50 | + | needs: changelog |
|
| 14 | 51 | runs-on: ${{ matrix.os }} |
|
| 15 | 52 | strategy: |
|
| 16 | 53 | matrix: |
|
| 75 | 112 | - name: Upload to release |
|
| 76 | 113 | uses: softprops/action-gh-release@v2 |
|
| 77 | 114 | with: |
|
| 115 | + | body: ${{ needs.changelog.outputs.release_notes }} |
|
| 78 | 116 | files: ${{ env.ASSET }} |
|
| 1 | + | [changelog] |
|
| 2 | + | header = """ |
|
| 3 | + | # Changelog\n |
|
| 4 | + | All notable changes to this project will be documented in this file.\n |
|
| 5 | + | """ |
|
| 6 | + | body = """ |
|
| 7 | + | {%- macro remote_url() -%} |
|
| 8 | + | https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }} |
|
| 9 | + | {%- endmacro -%} |
|
| 10 | + | ||
| 11 | + | {% if version -%} |
|
| 12 | + | ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} |
|
| 13 | + | {% else -%} |
|
| 14 | + | ## [Unreleased] |
|
| 15 | + | {% endif -%} |
|
| 16 | + | ||
| 17 | + | {% for group, commits in commits | group_by(attribute="group") %} |
|
| 18 | + | ### {{ group | striptags | trim | upper_first }} |
|
| 19 | + | {% for commit in commits %} |
|
| 20 | + | - {% if commit.scope %}*({{ commit.scope }})* {% endif %}{% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\ |
|
| 21 | + | {% endfor %} |
|
| 22 | + | {% endfor %}\n |
|
| 23 | + | """ |
|
| 24 | + | trim = true |
|
| 25 | + | ||
| 26 | + | [git] |
|
| 27 | + | conventional_commits = true |
|
| 28 | + | filter_unconventional = true |
|
| 29 | + | split_commits = false |
|
| 30 | + | commit_parsers = [ |
|
| 31 | + | { message = "^feat", group = "Features" }, |
|
| 32 | + | { message = "^fix", group = "Bug Fixes" }, |
|
| 33 | + | { message = "^docs", group = "Documentation" }, |
|
| 34 | + | { message = "^perf", group = "Performance" }, |
|
| 35 | + | { message = "^refactor", group = "Refactoring" }, |
|
| 36 | + | { message = "^style", group = "Styling" }, |
|
| 37 | + | { message = "^test", group = "Testing" }, |
|
| 38 | + | { message = "^chore\\(release\\)", skip = true }, |
|
| 39 | + | { message = "^chore\\(deps\\)", skip = true }, |
|
| 40 | + | { message = "^chore|^ci", group = "Miscellaneous" }, |
|
| 41 | + | ] |
|
| 42 | + | protect_breaking_commits = false |
|
| 43 | + | filter_commits = false |
|
| 44 | + | topo_order_commits = false |
|
| 45 | + | sort_commits = "oldest" |
|
| 46 | + | ||
| 47 | + | [remote.github] |
|
| 48 | + | owner = "stevedylandev" |
|
| 49 | + | repo = "sipp" |