Skip to content

Commit b40f96a

Browse files
authored
build: add release-plz for automating releases (#502)
* build: add release-plz for automating releases Signed-off-by: Esteve Fernandez <[email protected]> * build: exclude examples/rclrs_example_msgs from the Cargo workspace Signed-off-by: Esteve Fernandez <[email protected]> * build: explicitly list the members in the workspace Signed-off-by: Esteve Fernandez <[email protected]> * build: test CI with fix for colcon-cargo not discovering non-Cargo packages Signed-off-by: Esteve Fernandez <[email protected]> * build: only list rclrs in the Cargo.toml workspace file Signed-off-by: Esteve Fernandez <[email protected]> * build: revert changes for colcon-cargo fork Signed-off-by: Esteve Fernandez <[email protected]> --------- Signed-off-by: Esteve Fernandez <[email protected]>
1 parent 38a6a92 commit b40f96a

File tree

3 files changed

+86
-0
lines changed

3 files changed

+86
-0
lines changed

.github/workflows/release-plz.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Release-plz
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release-plz-release:
10+
name: Release-plz release
11+
runs-on: ubuntu-latest
12+
if: ${{ github.repository_owner == 'ros2-rust' }}
13+
permissions:
14+
contents: write
15+
steps:
16+
# Generating a GitHub token, so that PRs and tags created by
17+
# the release-plz-action can trigger actions workflows.
18+
- name: Generate GitHub token
19+
uses: actions/create-github-app-token@v2
20+
id: generate-token
21+
with:
22+
# GitHub App ID secret name
23+
app-id: ${{ secrets.APP_ID }}
24+
# GitHub App private key secret name
25+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
30+
token: ${{ steps.generate-token.outputs.token }}
31+
- name: Install Rust toolchain
32+
uses: dtolnay/rust-toolchain@stable
33+
- name: Run release-plz
34+
uses: release-plz/[email protected]
35+
with:
36+
command: release
37+
env:
38+
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
39+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
40+
41+
release-plz-pr:
42+
name: Release-plz PR
43+
runs-on: ubuntu-latest
44+
if: ${{ github.repository_owner == 'ros2-rust' }}
45+
permissions:
46+
pull-requests: write
47+
contents: write
48+
concurrency:
49+
group: release-plz-${{ github.ref }}
50+
cancel-in-progress: false
51+
steps:
52+
# Generating a GitHub token, so that PRs and tags created by
53+
# the release-plz-action can trigger actions workflows.
54+
- name: Generate GitHub token
55+
uses: actions/create-github-app-token@v2
56+
id: generate-token
57+
with:
58+
# GitHub App ID secret name
59+
app-id: ${{ secrets.APP_ID }}
60+
# GitHub App private key secret name
61+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
62+
- name: Checkout repository
63+
uses: actions/checkout@v4
64+
with:
65+
fetch-depth: 0
66+
token: ${{ steps.generate-token.outputs.token }}
67+
- name: Install Rust toolchain
68+
uses: dtolnay/rust-toolchain@stable
69+
- name: Run release-plz
70+
uses: release-plz/[email protected]
71+
with:
72+
command: release-pr
73+
env:
74+
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
75+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[workspace]
2+
members = [
3+
"rclrs",
4+
]
5+
resolver = "2"

release-plz.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[workspace]
2+
3+
[[package]]
4+
name = "rclrs"
5+
publish_features = ["use_ros_shim"]
6+
publish_all_features = false

0 commit comments

Comments
 (0)