Skip to content

Commit 34b6a73

Browse files
committed
ci: Split workflows between publish and changelog
1 parent 147929e commit 34b6a73

6 files changed

Lines changed: 162 additions & 59 deletions

File tree

.github/workflows/changelog.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: changelog.yml
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
7+
jobs:
8+
changelog:
9+
name: Generate changelog
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Generate changelog
20+
uses: orhun/git-cliff-action@v4
21+
with:
22+
config: cliff.toml
23+
args: --verbose
24+
env:
25+
OUTPUT: CHANGELOG.md
26+
GITHUB_REPO: ${{ github.repository }}
27+
28+
- name: Commit
29+
run: |
30+
git checkout main
31+
git config user.name 'github-actions[bot]'
32+
git config user.email 'github-actions[bot]@users.noreply.github.com'
33+
set +e
34+
git add CHANGELOG.md
35+
git commit -m "Update changelog"
36+
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git main

.github/workflows/check.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: check.yml
2+
on:
3+
pull_request:
4+
branches:
5+
- *
6+
7+
env:
8+
CARGO_TERM_COLOR: always
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Build
16+
run: cargo build --verbose
17+
- name: Run tests
18+
run: cargo test --verbose

.github/workflows/publish.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Rust
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions-rs/toolchain@v1
17+
with:
18+
toolchain: stable
19+
override: true
20+
- name: Publish to crates.io
21+
uses: katyo/publish-crates@v2
22+
with:
23+
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
24+

.github/workflows/rust.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

Changelog.md

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,26 @@
11
# Changelog
22

3-
**0.7.3**
3+
All notable changes to this project will be documented in this file.
44

5-
- Relax Peeker lifetime
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
67

7-
**0.7.2**
8+
## [0.3.0] - 2025-05-27
89

9-
- Fix Until behavior
10+
### Changed
1011

11-
**0.7.1**
12-
13-
- Fix UntilEnd behavior
14-
15-
**0.7.0**
16-
17-
- Allow to peek until a specific element
18-
19-
**0.6.0**
20-
21-
- Add Recognizer
22-
23-
**0.5.0**
12+
- Add support to delimited group
2413

25-
- Add support to separated list
14+
## [0.2.0] - 2025-05-25
2615

27-
**0.4.0**
16+
### Changed
2817

29-
- Add support to carriage return and tab recognizer
18+
- Add whitespaces visitor
3019

31-
**0.3.0**
20+
## [0.1.0] - 2025-05-25
3221

33-
- Add support to delimited group
22+
### Added
3423

35-
**0.2.0**
24+
- Initial commit
3625

37-
- Add support to peekable group
26+
<!-- generated by git-cliff -->

cliff.toml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# git-cliff ~ configuration file
2+
# https://git-cliff.org/docs/configuration
3+
4+
[changelog]
5+
# template for the changelog header
6+
header = """
7+
# Changelog\n
8+
All notable changes to this project will be documented in this file.
9+
10+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
11+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n
12+
"""
13+
# template for the changelog body
14+
# https://keats.github.io/tera/docs/#introduction
15+
body = """
16+
{% if version -%}
17+
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
18+
{% else -%}
19+
## [Unreleased]
20+
{% endif -%}
21+
{% for group, commits in commits | group_by(attribute="group") %}
22+
### {{ group | upper_first }}
23+
{% for commit in commits %}
24+
- {{ commit.message | split(pat="\n") | first | upper_first | trim }}\
25+
{% endfor %}
26+
{% endfor %}\n
27+
"""
28+
# template for the changelog footer
29+
footer = """
30+
{% for release in releases -%}
31+
{% if release.version -%}
32+
{% if release.previous.version -%}
33+
[{{ release.version | trim_start_matches(pat="v") }}]: \
34+
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}\
35+
/compare/{{ release.previous.version }}..{{ release.version }}
36+
{% endif -%}
37+
{% else -%}
38+
[unreleased]: https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}\
39+
/compare/{{ release.previous.version }}..HEAD
40+
{% endif -%}
41+
{% endfor %}
42+
<!-- generated by git-cliff -->
43+
"""
44+
# remove the leading and trailing whitespace from the templates
45+
trim = true
46+
47+
[git]
48+
# parse the commits based on https://www.conventionalcommits.org
49+
conventional_commits = true
50+
# filter out the commits that are not conventional
51+
filter_unconventional = false
52+
# regex for parsing and grouping commits
53+
commit_parsers = [
54+
{ message = "^[a|A]dd", group = "Added" },
55+
{ message = "^[s|S]upport", group = "Added" },
56+
{ message = "^[r|R]emove", group = "Removed" },
57+
{ message = "^.*: add", group = "Added" },
58+
{ message = "^.*: support", group = "Added" },
59+
{ message = "^.*: remove", group = "Removed" },
60+
{ message = "^.*: delete", group = "Removed" },
61+
{ message = "^test", group = "Fixed" },
62+
{ message = "^fix", group = "Fixed" },
63+
{ message = "^.*: fix", group = "Fixed" },
64+
{ message = "^.*", group = "Changed" },
65+
]
66+
# filter out the commits that are not matched by commit parsers
67+
filter_commits = false
68+
# sort the tags topologically
69+
topo_order = false
70+
# sort the commits inside sections by oldest/newest order
71+
sort_commits = "newest"

0 commit comments

Comments
 (0)