Skip to content

Commit

Permalink
ci: replace semantic-release with git-cliff and cliff-jumper
Browse files Browse the repository at this point in the history
Signed-off-by: rare-magma <[email protected]>
  • Loading branch information
rare-magma committed Jun 22, 2024
1 parent 5d0cfb2 commit 600a476
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 31 deletions.
24 changes: 14 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ jobs:
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
ref: main

- name: Install pnpm
uses: pnpm/action-setup@v4
Expand All @@ -95,15 +97,17 @@ jobs:
node-version: 20
cache: "pnpm"

- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
with:
extra_plugins: |
@semantic-release/commit-analyzer
@semantic-release/release-notes-generator
@semantic-release/changelog
@anolilab/semantic-release-pnpm
@semantic-release/github
@semantic-release/git
- name: Configure Git
run: |
git remote set-url origin "https://${GITHUB_TOKEN}:[email protected]/${GITHUB_REPOSITORY}.git"
git config --local user.email "${GITHUB_EMAIL}"
git config --local user.name "${GITHUB_USER}"
env:
GITHUB_USER: github-actions[bot]
GITHUB_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Bump Versions & Publish
run: pnpx @favware/cliff-jumper
env:
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
17 changes: 0 additions & 17 deletions .releaserc

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ See [LICENSE](LICENSE) for more information.
- [r/personalfinance](https://www.reddit.com/r/personalfinance/wiki/budgeting/)
- [Biome](https://biomejs.dev/)
- [Stylelint](https://stylelint.io/)
- [semantic-release](https://semantic-release.gitbook.io/semantic-release/)
- [git-cliff](https://git-cliff.org/)
- [testing-library](https://github.com/testing-library)
- [vite-plugin-pwa](https://github.com/vite-pwa/vite-plugin-pwa)
- [vitest](https://github.com/vitest-dev/vitest)
Expand Down
80 changes: 80 additions & 0 deletions cliff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# git-cliff ~ configuration file
# https://git-cliff.org/docs/configuration

[changelog]
# template for the changelog body
# https://keats.github.io/tera/docs/#introduction
body = """
{%- macro remote_url() -%}
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
{%- endmacro -%}
{% macro print_commit(commit) -%}
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
{% if commit.breaking %}[**breaking**] {% endif %}\
{{ commit.message | upper_first }} - \
([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}))\
{% endmacro -%}
{% if version %}\
{% if previous.version %}\
## [{{ version | trim_start_matches(pat="v") }}]\
({{ self::remote_url() }}/compare/{{ previous.version }}..{{ version }}) ({{ timestamp | date(format="%Y-%m-%d") }})
{% else %}\
## [{{ version | trim_start_matches(pat="v") }}] ({{ timestamp | date(format="%Y-%m-%d") }})
{% endif %}\
{% else %}\
## [unreleased]
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | striptags | trim | upper_first }}
{% for commit in commits
| filter(attribute="scope")
| sort(attribute="scope") %}
{{ self::print_commit(commit=commit) }}
{%- endfor -%}
{% raw %}\n{% endraw %}\
{%- for commit in commits %}
{%- if not commit.scope -%}
{{ self::print_commit(commit=commit) }}
{% endif -%}
{% endfor -%}
{% endfor %}\n
"""
# remove the leading and trailing whitespace from the templates
trim = true

[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 parsing and grouping commits
commit_parsers = [
{ message = "^feat", group = "Features" },
{ message = "^fix", group = "Bug Fixes" },
{ message = "^perf", group = "Performance" },
{ body = ".*security", group = "Security" },
{ body = "$^", skip = true },
]
# 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 = true
# 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"

[remote.github]
owner = "rare-magma"
repo = "guitos"
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,8 @@
"usehooks-ts": "3.1.0"
},
"devDependencies": {
"@anolilab/semantic-release-pnpm": "1.1.3",
"@biomejs/biome": "1.8.1",
"@playwright/test": "1.42.1",
"@semantic-release/changelog": "6.0.3",
"@semantic-release/git": "10.0.1",
"@simbathesailor/use-what-changed": "2.0.0",
"@testing-library/jest-dom": "6.4.2",
"@testing-library/react": "14.2.1",
Expand Down

0 comments on commit 600a476

Please sign in to comment.