Skip to content

Commit efa8c6e

Browse files
authoredNov 23, 2023
ci: switch release workflow to release-plz (#5)
1 parent 4935559 commit efa8c6e

File tree

4 files changed

+101
-31
lines changed

4 files changed

+101
-31
lines changed
 

‎.github/PULL_REQUEST_TEMPLATE.md

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Please provide a description below. -->
88

99
- [ ] Tests for the changes have been added (_for bug fixes / features_);
1010
- [ ] Docs have been added / updated (_for bug fixes / features_).
11-
- [ ] This PR has been added to [CHANGELOG.md](https://github.com/DDtKey/rocket-grants/blob/main/CHANGELOG.md) (to [Unreleased] section);
1211

1312
<!-- NOTE: these things are not required to open a PR and can be done afterwards / while the PR is open. -->
1413

‎.github/workflows/release.yml

+16-30
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,26 @@
11
name: Release
22

3-
on:
4-
push:
5-
tags:
6-
- '*.*.*'
3+
permissions:
4+
pull-requests: write
5+
contents: write
76

8-
env:
9-
CARGO_TERM_COLOR: always
7+
on:
8+
# Only manual trigger of releaase
9+
workflow_dispatch:
1010

1111
jobs:
12-
release:
13-
name: Release to crates.io
12+
releas:
13+
name: Release
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v1
17-
- name: Publish rocket-grants-proc-macro crate
18-
# It is not always necessary to update the macro, because this step may be unsuccessful
19-
run: |
20-
cargo login ${{ secrets.CRATES_TOKEN }}
21-
cd proc-macro
22-
cargo publish || true
23-
24-
- name: Wait for the proc-macro to be available in crates.io after publishing
25-
run: sleep 20s
26-
shell: bash
27-
28-
- uses: actions/checkout@v1
29-
- name: Publish rocket-grants
30-
run: |
31-
cargo login ${{ secrets.CRATES_TOKEN }}
32-
cargo publish
33-
34-
- name: Create GitHub release
35-
uses: softprops/action-gh-release@v1
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
3618
with:
37-
draft: true
38-
body_path: CHANGELOG.md
19+
fetch-depth: 0
20+
- name: Install Rust toolchain
21+
uses: dtolnay/rust-toolchain@stable
22+
- name: Run release-plz
23+
uses: MarcoIeni/release-plz-action@v0.5
3924
env:
4025
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

‎cliff.toml

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# git-cliff ~ default configuration file
2+
# https://git-cliff.org/docs/configuration
3+
#
4+
# Lines starting with "#" are comments.
5+
# Configuration options are organized into tables and keys.
6+
# See documentation for more information on available options.
7+
8+
[changelog]
9+
# changelog header
10+
header = """
11+
# Changelog\n
12+
All notable changes to this project will be documented in this file.\n
13+
"""
14+
# template for the changelog body
15+
# https://tera.netlify.app/docs
16+
body = """
17+
{% if version %}\
18+
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
19+
{% else %}\
20+
## [unreleased]
21+
{% endif %}\
22+
{% for group, commits in commits | group_by(attribute="group") %}
23+
### {{ group | upper_first }}
24+
{% for commit in commits %}
25+
- {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\
26+
{% endfor %}
27+
{% endfor %}\n
28+
"""
29+
# remove the leading and trailing whitespace from the template
30+
trim = true
31+
# changelog footer
32+
footer = """
33+
<!-- generated by git-cliff -->
34+
"""
35+
# postprocessors
36+
postprocessors = [
37+
# { pattern = '<REPO>', replace = "https://github.com/orhun/git-cliff" }, # replace repository URL
38+
]
39+
[git]
40+
# parse the commits based on https://www.conventionalcommits.org
41+
conventional_commits = true
42+
# filter out the commits that are not conventional
43+
filter_unconventional = true
44+
# process each line of a commit as an individual commit
45+
split_commits = false
46+
# regex for preprocessing the commit messages
47+
commit_preprocessors = [
48+
# { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))"}, # replace issue numbers
49+
]
50+
# regex for parsing and grouping commits
51+
commit_parsers = [
52+
{ message = "^feat", group = "Features" },
53+
{ message = "^fix", group = "Bug Fixes" },
54+
{ message = "^doc", group = "Documentation" },
55+
{ message = "^perf", group = "Performance" },
56+
{ message = "^refactor", group = "Refactor" },
57+
{ message = "^style", group = "Styling" },
58+
{ message = "^test", group = "Testing" },
59+
{ message = "^ci\\(deps\\)", skip = true },
60+
{ message = "^build\\(deps\\)", skip = true },
61+
{ message = "^chore: release", skip = true },
62+
{ message = "^chore\\(pr\\)", skip = true },
63+
{ message = "^chore\\(pull\\)", skip = true },
64+
{ message = "^chore|ci", group = "Miscellaneous Tasks" },
65+
{ body = ".*security", group = "Security" },
66+
{ message = "^revert", group = "Revert" },
67+
]
68+
# protect breaking changes from being skipped due to matching a skipping commit_parser
69+
protect_breaking_commits = false
70+
# filter out the commits that are not matched by commit parsers
71+
filter_commits = false
72+
# glob pattern for matching git tags
73+
tag_pattern = "v[0-9]*"
74+
# regex for ignoring tags
75+
ignore_tags = ""
76+
# sort the tags topologically
77+
topo_order = false
78+
# sort the commits inside sections by oldest/newest order
79+
sort_commits = "oldest"
80+
# limit the number of commits included in the changelog.
81+
# limit_commits = 42

‎release-plz.toml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[workspace]
2+
changelog_config = "cliff.toml" # use a custom git-cliff configuration
3+
git_release_enable = true # enable GitHub releases
4+
pr_labels = ["release"] # add the `release` label to the release Pull Request

0 commit comments

Comments
 (0)
Please sign in to comment.