Skip to content

Commit 23a4e86

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

File tree

6 files changed

+144
-8
lines changed

6 files changed

+144
-8
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: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,36 @@ 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+
- name: Setup PHP
29+
uses: shivammathur/setup-php@v2
30+
with:
31+
php-version: '8.2'
32+
env:
33+
debug: true
34+
- name: Setup Rust
35+
uses: dtolnay/rust-toolchain@master
36+
with:
37+
components: rustfmt, clippy
38+
- name: Run rustfmt
39+
run: cargo fmt --all -- --check
40+
- name: Run clippy
41+
run: cargo clippy --all -- -D warnings rm convco
1242
build:
1343
name: Build and Test
1444
runs-on: ${{ matrix.os }}
@@ -89,15 +119,9 @@ jobs:
89119
env:
90120
EXT_PHP_RS_TEST: ""
91121
run: cargo build --release --features closure,anyhow --all
92-
# Test & lint
122+
# Test
93123
- name: Test inline examples
94124
run: cargo test --release --all --features closure,anyhow --no-fail-fast
95-
- name: Run rustfmt
96-
if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.2'
97-
run: cargo fmt --all -- --check
98-
- name: Run clippy
99-
if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.2'
100-
run: cargo clippy --all -- -D warnings
101125
# Docs
102126
- name: Run rustdoc
103127
if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' && matrix.php == '8.2'

.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+
"""

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,11 @@ Contributions welcome include:
181181
- Bug fixes and features.
182182
- Feature requests.
183183

184+
When contributing, please keep in mind the following:
185+
- Create tests if possible.
186+
- Update the documentation if necessary.
187+
- Use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/). We use these to automatically generate changelogs.
188+
184189
Unless you explicitly state otherwise, any contribution intentionally submitted
185190
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
186191
dual licensed as above, without any additional terms or conditions.

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)