Skip to content

Commit 6210e1a

Browse files
committed
chore(dev): review the release process
includes fixes to the nu script and updates to the git-cliff config
1 parent d1e2136 commit 6210e1a

5 files changed

Lines changed: 40 additions & 26 deletions

File tree

.config/cliff.toml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ body = """
2828
2929
> {{ message }}
3030
{%- endif %}
31-
{% else -%}
31+
{% elif previous.timestamp -%}
3232
## [{{ UNRELEASED }}] - {{ previous.timestamp | date(format="%Y-%m-%d") }} to present
33+
{% else -%}
34+
## [{{ UNRELEASED }}]
3335
{% endif -%}
3436
3537
{% for group, commits in commits | group_by(attribute="group") %}
@@ -45,14 +47,19 @@ body = """
4547
{% endfor %}
4648
{% endfor -%}
4749
48-
{% set first_commit = previous.version -%}
49-
{%- set last_commit = "HEAD" -%}
5050
{% if version -%}
51+
{#- Use the current version tag as the latest commit -#}
5152
{%- set last_commit = version -%}
52-
{%- if not previous.version -%}
53-
{#- If this is the first versioned release, use the initial commit -#}
54-
{%- set first_commit = init_commit -%}
55-
{%- endif -%}
53+
{%- else -%}
54+
{#- Otherwise, just call it HEAD -#}
55+
{%- set last_commit = "HEAD" -%}
56+
{%- endif -%}
57+
{%- if not previous.version -%}
58+
{#- If this is the first versioned release, use the initial commit -#}
59+
{%- set first_commit = init_commit -%}
60+
{%- else -%}
61+
{#- Otherwise, use the previous version tag as the starting point -#}
62+
{%- set first_commit = previous.version -%}
5663
{%- endif %}
5764
[{{ this_version }}]: {{ self::remote_url() }}/compare/{{ first_commit }}...{{ last_commit }}
5865
@@ -148,10 +155,11 @@ commit_parsers = [
148155
# filter out the commits that are not matched by commit parsers
149156
filter_commits = true
150157
# sort the tags topologically
158+
# spell-checker: disable-next-line
151159
topo_order = false
152160
# sort the commits inside sections by oldest/newest order
153161
sort_commits = "oldest"
154162

155-
# [remote.github]
156-
# owner = "cpp-linter"
157-
# repo = "cpp-linter-rs"
163+
[remote.github]
164+
owner = "cpp-linter"
165+
repo = "cpp-linter-rs"

.github/common.nu

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export def --wrapped run-cmd [...cmd: string] {
3636
($cmd | first)
3737
}
3838
print $"(ansi blue)\nRunning(ansi reset) ($cmd | str join ' ')"
39+
# spell-checker: disable-next-line
3940
let elapsed = timeit {|| ^($cmd | first) ...($cmd | skip 1)}
4041
print $"(ansi magenta)($app) took ($elapsed)(ansi reset)"
4142
}

.github/workflows/bump-n-release.nu

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
#
66
# This step requires `cargo-edit` installed.
77
#
8+
# If bumping the cpp-linter-js package, yarn must be installed to
9+
# update the version in the bindings/node/package.json manifest also.
10+
#
811
# 2. Updates the appropriate CHANGELOG.md
912
#
1013
# Requires `git-cliff` (see https://git-cliff.org) to be installed
@@ -85,6 +88,7 @@ const PkgPaths = {
8588
path: 'bindings/node'
8689
}
8790
}
91+
8892
export def get-changed-pkgs [] {
8993
let changed_files = (
9094
git 'diff' '--name-only' 'HEAD~1' 'HEAD'
@@ -99,17 +103,15 @@ export def get-changed-pkgs [] {
99103
let pkg = $row.column0
100104
let paths = $row.column1
101105
print $"Checking changes for ($pkg)..."
102-
let has_changed = if ($paths.include | is-empty) {
103-
true
104-
} else {
105-
$changed_files | any {|file| $paths.include | each {|p| glob $p | any {|g| $g == $file}}}
106+
let has_changed = if ($paths.include | is-empty) { true } else {
107+
$changed_files | any {|file| $paths.include | any {|p| ($file | path expand) in (glob $p)}}
106108
}
107109
print $" Has changes: ($has_changed)"
108110
let has_excluded_change = if ($paths.exclude | is-empty) { false } else {
109-
$changed_files | any {|file| $paths.exclude | each {|p| glob $p | any {|g| $g == $file}}}
111+
$changed_files | any {|file| $paths.exclude | any {|p| ($file | path expand) in (glob $p)}}
110112
}
111113
print $" Has excluded changes: ($has_excluded_change)"
112-
if $has_changed and not $has_excluded_change {
114+
if $has_changed {
113115
print $" Package ($pkg) has relevant changes"
114116
$pkgs = $pkgs | append $pkg
115117
}
@@ -186,8 +188,6 @@ export def gen-changes [
186188
mut args = [
187189
'--config' $"($config_path | path join 'cliff.toml')"
188190
'--tag-pattern' $"($pkg)/*"
189-
'--workdir' $path
190-
'--repository' (pwd)
191191
]
192192
if (($tag | str length) > 0) {
193193
$args = $args | append ['--tag', $tag]
@@ -255,13 +255,13 @@ def main [
255255
}
256256
if (is-in-ci) and $is_main {
257257
print 'Pushing metadata changes'
258-
run-cmd 'git' 'config' '--global' 'user.name' $"($env.GITHUB_ACTOR)"
259-
run-cmd 'git' 'config' '--global' 'user.email' $"($env.GITHUB_ACTOR_ID)+($env.GITHUB_ACTOR)@users.noreply.github.com"
260-
run-cmd 'git' 'add' '--all'
261-
run-cmd 'git' 'commit' '-m' $"build: bump version to ($tag)"
262-
run-cmd 'git' 'push'
258+
run-cmd git config --global user.name $"($env.GITHUB_ACTOR)"
259+
run-cmd git config --global user.email $"($env.GITHUB_ACTOR_ID)+($env.GITHUB_ACTOR)@users.noreply.github.com"
260+
run-cmd git add --all
261+
run-cmd git commit -m $"build: bump version to ($tag)"
262+
run-cmd git push
263263
print $"Deploying ($tag)"
264-
run-cmd 'gh' 'release' 'create' $tag '--notes-file' '.config/ReleaseNotes.md' '--title' $"($pkg) v($ver)"
264+
run-cmd gh release create $tag --notes-file .config/ReleaseNotes.md --title $"($pkg) v($ver)"
265265
} else if $is_main {
266266
print $"(ansi yellow)Not deploying from local clone.(ansi reset)"
267267
}

.github/workflows/bump-n-release.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ jobs:
6262
- run: cargo binstall -y git-cliff
6363
env:
6464
GITHUB_TOKEN: ${{ github.token }}
65+
- name: Install cargo-edit
66+
run: >-
67+
cargo install cargo-edit
68+
--locked
69+
--no-default-features
70+
--features set-version
6571
- name: Install nushell
6672
uses: hustcer/setup-nu@92c296ba1ba2ba04cc948ab64ddefe192dc13f0c # v3.23
6773
- name: Bump ${{ inputs.component }} version

cspell.config.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ words:
2929
- ecurity
3030
- efactor
3131
- elete
32+
- elif
3233
- emove
3334
- endfor
3435
- endgroup
@@ -114,8 +115,6 @@ words:
114115
- tempdir
115116
- tempfile
116117
- thiserror
117-
- timeit
118-
- topo
119118
- twemoji
120119
- upport
121120
- vararg

0 commit comments

Comments
 (0)