Skip to content

Commit 42a2913

Browse files
ci: add release-crates workflow for crates.io publishing (#74)
Add automated crates.io publishing workflow using release-plz. **New files:** - \.github/workflows/release-crates.yml\ — Two-job workflow (open release PR + publish crates) - \ elease-plz.toml\ — Configuration with \git_release_enable = false\, semver checks, conventional commit filtering **Prerequisites for DevOps:** 1. Create \cratesio-publish\ GitHub environment 2. Configure trusted publishing on crates.io for \cadeau\ and \xmf-sys\ crates 3. Ensure \DEVOLUTIONSBOT_WRITE_TOKEN\ secret is available in this repo
1 parent a75c782 commit 42a2913

2 files changed

Lines changed: 68 additions & 0 deletions

File tree

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Release crates
2+
3+
permissions:
4+
pull-requests: write
5+
contents: write
6+
7+
on:
8+
workflow_dispatch:
9+
push:
10+
branches:
11+
- master
12+
13+
jobs:
14+
# Create a PR with the new versions and changelog, preparing the next release.
15+
open-pr:
16+
name: Open release PR
17+
environment: cratesio-publish
18+
runs-on: ubuntu-latest
19+
concurrency:
20+
group: release-plz-${{ github.ref }}
21+
cancel-in-progress: false
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 512
28+
29+
- name: Run release-plz
30+
id: release-plz
31+
uses: Devolutions/actions-public/release-plz@v1
32+
with:
33+
command: release-pr
34+
manifest-path: rust/Cargo.toml
35+
git-name: Devolutions Bot
36+
git-email: bot@devolutions.net
37+
github-token: ${{ secrets.DEVOLUTIONSBOT_WRITE_TOKEN }}
38+
39+
# Release unpublished packages.
40+
release:
41+
name: Release crates
42+
environment: cratesio-publish
43+
runs-on: ubuntu-latest
44+
permissions:
45+
id-token: write
46+
47+
steps:
48+
- name: Checkout repository
49+
uses: actions/checkout@v4
50+
with:
51+
fetch-depth: 512
52+
53+
- name: Authenticate with crates.io
54+
id: auth
55+
uses: rust-lang/crates-io-auth-action@v1
56+
57+
- name: Run release-plz
58+
uses: Devolutions/actions-public/release-plz@v1
59+
with:
60+
command: release
61+
manifest-path: rust/Cargo.toml
62+
registry-token: ${{ steps.auth.outputs.token }}

release-plz.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[workspace]
2+
git_release_enable = false
3+
semver_check = true
4+
pr_branch_prefix = "release-plz/"
5+
pr_name = "chore(release): prepare for publishing"
6+
release_commits = "^(feat|docs|fix|build|perf)"

0 commit comments

Comments
 (0)