Skip to content

Commit cf99e28

Browse files
committed
ci(release): add release bot
Refs: #340
1 parent 59721e4 commit cf99e28

File tree

5 files changed

+125
-1
lines changed

5 files changed

+125
-1
lines changed

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
# Check for updates every Monday
6+
schedule:
7+
interval: "weekly"

.github/workflows/build.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,23 @@ on:
99
pull_request:
1010

1111
jobs:
12+
lint:
13+
name: Lint
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
- name: Check typos
21+
uses: crate-ci/typos@master
22+
- name: Validate commit messages
23+
run: |
24+
git show-ref
25+
curl -sSfL https://github.com/convco/convco/releases/latest/download/convco-ubuntu.zip | zcat > convco
26+
chmod +x convco
27+
./convco check refs/remotes/origin/master..HEAD
28+
rm convco
1229
build:
1330
name: Build and Test
1431
runs-on: ${{ matrix.os }}

.github/workflows/release-plz.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Release-plz
2+
3+
permissions:
4+
pull-requests: write
5+
contents: write
6+
7+
on:
8+
workflow_run:
9+
workflows: ["Build and Lint"]
10+
branches: ["master"]
11+
types:
12+
- completed
13+
14+
jobs:
15+
release-plz-release:
16+
name: Release-plz release
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Generate GitHub token
20+
uses: actions/create-github-app-token@v1
21+
id: generate-token
22+
with:
23+
app-id: ${{ secrets.APP_ID }}
24+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0
29+
- name: Install Rust toolchain
30+
uses: dtolnay/rust-toolchain@stable
31+
- name: Run release-plz
32+
uses: release-plz/[email protected]
33+
with:
34+
command: release
35+
env:
36+
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
37+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
38+
39+
release-plz-pr:
40+
name: Release-plz PR
41+
runs-on: ubuntu-latest
42+
concurrency:
43+
group: release-plz-${{ github.ref }}
44+
cancel-in-progress: false
45+
steps:
46+
- name: Generate GitHub token
47+
uses: actions/create-github-app-token@v1
48+
id: generate-token
49+
with:
50+
app-id: ${{ secrets.APP_ID }}
51+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
52+
- name: Checkout repository
53+
uses: actions/checkout@v4
54+
with:
55+
fetch-depth: 0
56+
- name: Install Rust toolchain
57+
uses: dtolnay/rust-toolchain@stable
58+
- name: Run release-plz
59+
uses: release-plz/[email protected]
60+
with:
61+
command: release-pr
62+
env:
63+
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
64+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

.release-plz.toml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[workspace]
2+
git_release_body = """
3+
{{ changelog }}
4+
{% if remote.contributors %}
5+
### Thanks to the contributors for this release:
6+
{% for contributor in remote.contributors %}
7+
* @{{ contributor.username }}
8+
{% endfor %}
9+
{% endif %}
10+
"""
11+
12+
[changelog]
13+
header = "# Changelog"
14+
body = """
15+
{% macro commit_message(commit) %}
16+
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}{% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message }}{% if commit.remote %} by @{{ commit.remote.username }}{% endif %} {%- if commit.links %} ({% for link in commit.links %}[{{link.text}}]({{link.href}}) {% endfor %}){% endif %}
17+
{%- if commit.breaking and commit.breaking_description %}
18+
> {{ commit.breaking_description -}}
19+
{% endif -%}
20+
{% endmacro %}
21+
## [{{ version | trim_start_matches(pat="v") }}]{%- if release_link -%}({{ release_link }}){% endif %} - {{ timestamp | date(format="%Y-%m-%d") -}}
22+
{%- for group, commits in commits | group_by(attribute="group") %}
23+
24+
### {{ group | upper_first -}}
25+
{% for scope, commits in commits | group_by(attribute="scope") -%}
26+
{%- for commit in commits -%}
27+
{{- self::commit_message(commit=commit) -}}
28+
{% endfor -%}
29+
{% endfor -%}
30+
{%- for commit in commits -%}
31+
{% if not commit.scope -%}
32+
{{- self::commit_message(commit=commit) -}}
33+
{% endif -%}
34+
{% endfor -%}
35+
{% endfor %}
36+
"""

crates/cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ edition = "2018"
1111
categories = ["api-bindings", "command-line-interface"]
1212

1313
[dependencies]
14-
ext-php-rs = { version = ">=0.7.1", path = "../../" }
14+
ext-php-rs = { version = "0.12.0", path = "../../" }
1515

1616
clap = { version = "4.0", features = ["derive"] }
1717
anyhow = "1"

0 commit comments

Comments
 (0)