Skip to content

Commit 4df8677

Browse files
committed
ci: add workflow to create a PR for crate bumps
Changelog-None
1 parent 2b8b709 commit 4df8677

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed

.github/workflows/crate-bump.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Bump Rust 🦀 crate versions
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+'
7+
- 'v[0-9]+.[0-9]+.[0-9]+'
8+
- 'v[0-9]+.[0-9]+[0-9a-z]+'
9+
workflow_dispatch:
10+
inputs:
11+
dist-location:
12+
description: 'Distribution location'
13+
type: choice
14+
options:
15+
- rc
16+
- major
17+
- minor
18+
default: 'rc'
19+
required: false
20+
21+
jobs:
22+
bump:
23+
runs-on: ubuntu-latest
24+
timeout-minutes: 120
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
with:
29+
# Need to fetch entire history in order to locate the version tag
30+
fetch-depth: 0
31+
32+
- name: Check version tag
33+
run: >-
34+
git describe --tags --always --dirty=-modded --abbrev=7
35+
36+
- name: Set up values
37+
id: set-values
38+
run: |
39+
if [[ "${{ github.event.inputs.dist-location }}" != "" ]]; then
40+
DISTLOCATION=${{ github.event.inputs.dist-location }}
41+
elif [[ "${{ github.ref_type }}" == "tag" ]]; then
42+
if [[ "${{ github.ref_name }}" =~ ^v[0-9]+\.[0-9]+$ ]]; then
43+
DISTLOCATION="major"
44+
elif [[ "${{ github.ref_name }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
45+
DISTLOCATION="minor"
46+
elif [[ "${{ github.ref_name }}" =~ ^v[0-9]+\.[0-9]+[0-9a-z]+$ ]]; then
47+
DISTLOCATION="rc"
48+
else
49+
echo "Tag format not recognized"
50+
exit 1
51+
fi
52+
else
53+
echo "Neither tag nor workflow dispatch"
54+
exit 1
55+
fi
56+
echo "DISTLOCATION=$DISTLOCATION" >> $GITHUB_OUTPUT
57+
echo "EVENT DISTLOCATION: ${{ github.event.inputs.dist-location }}"
58+
echo "DISTRIBUTION LOCATION: $DISTLOCATION"
59+
60+
- name: Setup rust
61+
uses: dtolnay/[email protected]
62+
63+
- name: Install cargo release
64+
run: |
65+
cargo install --locked cargo-release --version 0.25.10
66+
67+
- name: Bump rc version
68+
if: github.repository == 'daywalker90/lightning' && steps.set-values.outputs.DISTLOCATION == 'rc'
69+
run: |
70+
cargo release version -p cln-rpc -p cln-grpc -p cln-plugin rc --execute --no-confirm
71+
72+
- name: Bump minor release version
73+
if: github.repository == 'daywalker90/lightning' && steps.set-values.outputs.DISTLOCATION == 'major'
74+
run: |
75+
cargo release version -p cln-rpc -p cln-grpc -p cln-plugin minor --execute --no-confirm
76+
77+
- name: Bump patch release version
78+
if: github.repository == 'daywalker90/lightning' && steps.set-values.outputs.DISTLOCATION == 'minor'
79+
run: |
80+
cargo release version -p cln-rpc -p cln-grpc -p cln-plugin patch --execute --no-confirm
81+
82+
- name: Create Pull Request
83+
if: github.repository == 'ElementsProject/lightning'
84+
uses: peter-evans/create-pull-request@v7
85+
with:
86+
token: ${{ secrets.GITHUB_TOKEN }}
87+
commit-message: "crates: Bump crate versions for ${{ github.ref_name }}"
88+
title: "Bump crate versions for ${{ github.ref_name }}"
89+
body: |
90+
This PR bumps the crate versions for:
91+
- cln-rpc
92+
- cln-grpc
93+
- cln-plugin
94+
95+
Triggered by tag: ${{ github.ref_name }}
96+
Distribution location: ${{ steps.set-values.outputs.DISTLOCATION }}
97+
branch: "bump-crate-versions-${{ github.ref_name }}"
98+
base: master
99+
labels: version-bump, automated
100+
delete-branch: true

0 commit comments

Comments
 (0)