Skip to content

Commit 2e328ef

Browse files
committed
ci: add workflow to create a PR for crate bumps
Changelog-None
1 parent 85d93e0 commit 2e328ef

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

.github/workflows/crate-bump.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Bump Rust 🦀 crate version
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
dist-location:
7+
description: 'Distribution location'
8+
type: choice
9+
options:
10+
- cln-plugin
11+
- cln-rpc
12+
- cln-grpc
13+
default: 'cln-plugin'
14+
required: true
15+
16+
jobs:
17+
bump:
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 60
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: Setup protoc
25+
uses: arduino/setup-protoc@v3
26+
27+
- name: Setup rust
28+
uses: dtolnay/[email protected]
29+
30+
- name: Install cargo binstall
31+
uses: cargo-bins/cargo-binstall@main
32+
33+
- name: Install cargo-release and cargo-semver-checks
34+
run: |
35+
cargo binstall cargo-release --version 0.25.10
36+
cargo binstall cargo-semver-checks --version 0.36.0
37+
38+
- name: Determine version
39+
id: determine-version
40+
run: |
41+
if cargo semver-checks -p ${{ github.event.inputs.dist-location }} --release-type patch; then
42+
echo "bump=patch" >> $GITHUB_OUTPUT
43+
elif cargo semver-checks -p ${{ github.event.inputs.dist-location }} --release-type minor; then
44+
echo "bump=minor" >> $GITHUB_OUTPUT
45+
elif cargo semver-checks -p ${{ github.event.inputs.dist-location }} --release-type major; then
46+
echo "bump=minor" >> $GITHUB_OUTPUT
47+
else
48+
echo "bump=unknown" >> $GITHUB_OUTPUT
49+
exit 1
50+
fi
51+
52+
- name: Bump version
53+
run: |
54+
cargo release version -p ${{ github.event.inputs.dist-location }} ${{ steps.determine-version.outputs.bump }} --execute --no-confirm
55+
56+
- name: Create Pull Request
57+
uses: peter-evans/create-pull-request@v7
58+
with:
59+
token: ${{ secrets.GITHUB_TOKEN }}
60+
commit-message: "${{ github.event.inputs.dist-location }}: Bump the ${{ steps.determine-version.outputs.bump }} version"
61+
title: "${{ github.event.inputs.dist-location }}: Bump the ${{ steps.determine-version.outputs.bump }} version"
62+
body: |
63+
Triggered manually with option: ${{ github.event.inputs.dist-location }}
64+
Version bump determined by `cargo semver-checks`
65+
branch: "${{ github.event.inputs.dist-location }}-version-bump"
66+
base: master
67+
labels: version-bump, automated
68+
delete-branch: true

0 commit comments

Comments
 (0)