Skip to content

Commit 0e5bc0d

Browse files
ci: setup release process (#7)
1 parent 4758d9b commit 0e5bc0d

File tree

2 files changed

+157
-0
lines changed

2 files changed

+157
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Prepare Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version to release (e.g., 1.0.0)'
8+
required: true
9+
type: string
10+
11+
run-name: "Prepare release: ${{ inputs.version }}"
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
update-version:
18+
name: Update Version
19+
runs-on: ubuntu-latest
20+
outputs:
21+
version: ${{ steps.version.outputs.version }}
22+
steps:
23+
- name: Set Apix Bot token
24+
id: app-token
25+
uses: mongodb/apix-action/token@6c3fde402c21942fa46cde003f190c2b23c59530
26+
with:
27+
app-id: ${{ secrets.APIXBOT_APP_ID }}
28+
private-key: ${{ secrets.APIXBOT_APP_PEM }}
29+
- uses: actions/checkout@v6
30+
with:
31+
token: ${{ steps.app-token.outputs.token }}
32+
fetch-depth: 0
33+
- name: Install Rust toolchain
34+
uses: dtolnay/rust-toolchain@stable
35+
with:
36+
toolchain: stable
37+
targets: x86_64-unknown-linux-gnu
38+
- name: Install cargo-binstall
39+
uses: cargo-bins/[email protected]
40+
- name: Install cargo-edit to update Cargo.toml version
41+
run: cargo binstall --no-confirm --locked cargo-edit
42+
- name: Install cargo tools for license verification
43+
run: cargo binstall --no-confirm --locked cargo-about
44+
- name: Update Cargo.toml version
45+
run: cargo edit set version "${{ github.event.inputs.version }}"
46+
- name: Update third-party licenses
47+
run: cargo about generate about.hbs > LICENSE-3RD-PARTY.txt
48+
- name: Generate changelog
49+
uses: orhun/git-cliff-action@v4
50+
with:
51+
config: cliff.toml
52+
args: --tag ${{ github.event.inputs.version }} --verbose
53+
env:
54+
OUTPUT: CHANGELOG.md
55+
GITHUB_REPO: ${{ github.repository }}
56+
- name: Commit version changes
57+
run: |
58+
git config --global user.name "${{ steps.app-token.outputs.user-name }}"
59+
git config --global user.email "${{ steps.app-token.outputs.user-email }}"
60+
git add Cargo.toml Cargo.lock CHANGELOG.md LICENSE-3RD-PARTY.txt
61+
git commit -m "chore(release): prepare for ${{ github.event.inputs.version }}"
62+
git tag "v${{ github.event.inputs.version }}"
63+
git push
64+
git push --tags

β€Žcliff.tomlβ€Ž

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# git-cliff ~ configuration file
2+
# https://git-cliff.org/docs/configuration
3+
4+
5+
[changelog]
6+
# A Tera template to be rendered for each release in the changelog.
7+
# See https://keats.github.io/tera/docs/#introduction
8+
body = """
9+
{% if version %}\
10+
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
11+
{% else %}\
12+
## [unreleased]
13+
{% endif %}\
14+
{% for group, commits in commits | group_by(attribute="group") %}
15+
### {{ group | striptags | trim | upper_first }}
16+
{% for commit in commits %}
17+
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
18+
{% if commit.breaking %}[**breaking**] {% endif %}\
19+
{{ commit.message | upper_first }}\
20+
{% endfor %}
21+
{% endfor %}
22+
"""
23+
# Remove leading and trailing whitespaces from the changelog's body.
24+
trim = true
25+
# Render body even when there are no releases to process.
26+
render_always = true
27+
# An array of regex based postprocessors to modify the changelog.
28+
postprocessors = [
29+
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](https://github.com/mongodb/atlas-local-cli/pull/${2}))" },
30+
]
31+
# render body even when there are no releases to process
32+
# render_always = true
33+
# output file path
34+
# output = "test.md"
35+
36+
[git]
37+
# Parse commits according to the conventional commits specification.
38+
# See https://www.conventionalcommits.org
39+
conventional_commits = true
40+
# Exclude commits that do not match the conventional commits specification.
41+
filter_unconventional = true
42+
# Require all commits to be conventional.
43+
# Takes precedence over filter_unconventional.
44+
require_conventional = false
45+
# Split commits on newlines, treating each line as an individual commit.
46+
split_commits = false
47+
# An array of regex based parsers to modify commit messages prior to further processing.
48+
commit_preprocessors = [
49+
# Replace issue numbers with link templates to be updated in `changelog.postprocessors`.
50+
#{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))"},
51+
# Check spelling of the commit message using https://github.com/crate-ci/typos.
52+
# If the spelling is incorrect, it will be fixed automatically.
53+
#{ pattern = '.*', replace_command = 'typos --write-changes -' },
54+
]
55+
# Prevent commits that are breaking from being excluded by commit parsers.
56+
protect_breaking_commits = false
57+
# An array of regex based parsers for extracting data from the commit message.
58+
# Assigns commits to groups.
59+
# Optionally sets the commit's scope and can decide to exclude commits from further processing.
60+
commit_parsers = [
61+
{ message = "^feat", group = "<!-- 0 -->πŸš€ Features" },
62+
{ message = "^fix", group = "<!-- 1 -->πŸ› Bug Fixes" },
63+
{ message = "^doc", group = "<!-- 3 -->πŸ“š Documentation" },
64+
{ message = "^perf", group = "<!-- 4 -->⚑ Performance" },
65+
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
66+
{ message = "^style", group = "<!-- 5 -->🎨 Styling" },
67+
{ message = "^test", group = "<!-- 6 -->πŸ§ͺ Testing" },
68+
{ message = "^chore\\(release\\): prepare for", skip = true },
69+
{ message = "^chore\\(deps.*\\)", skip = true },
70+
{ message = "^chore\\(pr\\)", skip = true },
71+
{ message = "^chore\\(pull\\)", skip = true },
72+
{ message = "^chore|^ci", group = "<!-- 7 -->βš™οΈ Miscellaneous Tasks" },
73+
{ body = ".*security", group = "<!-- 8 -->πŸ›‘οΈ Security" },
74+
{ message = "^revert", group = "<!-- 9 -->◀️ Revert" },
75+
{ message = ".*", group = "<!-- 10 -->πŸ’Ό Other" },
76+
]
77+
# Exclude commits that are not matched by any commit parser.
78+
filter_commits = false
79+
# An array of link parsers for extracting external references, and turning them into URLs, using regex.
80+
link_parsers = [
81+
{ pattern = "#(\\d+)", href = "https://github.com/mongodb/atlas-local-lib-js/issues/$1" },
82+
]
83+
# Include only the tags that belong to the current branch.
84+
use_branch_tags = false
85+
# Order releases topologically instead of chronologically.
86+
topo_order = false
87+
# Order releases topologically instead of chronologically.
88+
topo_order_commits = true
89+
# Order of commits in each group/release within the changelog.
90+
# Allowed values: newest, oldest
91+
sort_commits = "oldest"
92+
# Process submodules commits
93+
recurse_submodules = false

0 commit comments

Comments
Β (0)