Skip to content

Commit

Permalink
ci(release): add release bot
Browse files Browse the repository at this point in the history
Refs: #340
  • Loading branch information
Xenira committed Dec 1, 2024
1 parent 59721e4 commit cf99e28
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
# Check for updates every Monday
schedule:
interval: "weekly"
17 changes: 17 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,23 @@ on:
pull_request:

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check typos
uses: crate-ci/typos@master
- name: Validate commit messages
run: |
git show-ref
curl -sSfL https://github.com/convco/convco/releases/latest/download/convco-ubuntu.zip | zcat > convco
chmod +x convco
./convco check refs/remotes/origin/master..HEAD
rm convco
build:
name: Build and Test
runs-on: ${{ matrix.os }}
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/release-plz.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Release-plz

permissions:
pull-requests: write
contents: write

on:
workflow_run:
workflows: ["Build and Lint"]
branches: ["master"]
types:
- completed

jobs:
release-plz-release:
name: Release-plz release
runs-on: ubuntu-latest
steps:
- name: Generate GitHub token
uses: actions/create-github-app-token@v1
id: generate-token
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run release-plz
uses: release-plz/[email protected]
with:
command: release
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

release-plz-pr:
name: Release-plz PR
runs-on: ubuntu-latest
concurrency:
group: release-plz-${{ github.ref }}
cancel-in-progress: false
steps:
- name: Generate GitHub token
uses: actions/create-github-app-token@v1
id: generate-token
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run release-plz
uses: release-plz/[email protected]
with:
command: release-pr
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
36 changes: 36 additions & 0 deletions .release-plz.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[workspace]
git_release_body = """
{{ changelog }}
{% if remote.contributors %}
### Thanks to the contributors for this release:
{% for contributor in remote.contributors %}
* @{{ contributor.username }}
{% endfor %}
{% endif %}
"""

[changelog]
header = "# Changelog"
body = """
{% macro commit_message(commit) %}
- {% 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 %}
{%- if commit.breaking and commit.breaking_description %}
> {{ commit.breaking_description -}}
{% endif -%}
{% endmacro %}
## [{{ version | trim_start_matches(pat="v") }}]{%- if release_link -%}({{ release_link }}){% endif %} - {{ timestamp | date(format="%Y-%m-%d") -}}
{%- for group, commits in commits | group_by(attribute="group") %}
### {{ group | upper_first -}}
{% for scope, commits in commits | group_by(attribute="scope") -%}
{%- for commit in commits -%}
{{- self::commit_message(commit=commit) -}}
{% endfor -%}
{% endfor -%}
{%- for commit in commits -%}
{% if not commit.scope -%}
{{- self::commit_message(commit=commit) -}}
{% endif -%}
{% endfor -%}
{% endfor %}
"""
2 changes: 1 addition & 1 deletion crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ edition = "2018"
categories = ["api-bindings", "command-line-interface"]

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

clap = { version = "4.0", features = ["derive"] }
anyhow = "1"
Expand Down

0 comments on commit cf99e28

Please sign in to comment.