Skip to content

Commit d5e5de2

Browse files
committed
Update release workflow for Crates project structure
1 parent c9b8b8c commit d5e5de2

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

.github/workflows/release.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_dispatch:
55
inputs:
66
version:
7-
description: 'Version to release, e.g. "v0.0.1" (optional, will auto-increment if not provided)'
7+
description: 'Version to release, e.g. "v0.1.6" (optional, will auto-increment if not provided)'
88
required: false
99
type: string
1010

@@ -24,10 +24,10 @@ jobs:
2424
git config --global user.name "GitHub Actions"
2525
git config --global user.email "actions@github.com"
2626
27-
- name: Parse version from Cargo.toml
27+
- name: Parse version from main crate
2828
id: cargo_version
2929
run: |
30-
CURRENT_VERSION=$(grep -m 1 "^version = " Cargo.toml | sed 's/version = "\(.*\)"/\1/')
30+
CURRENT_VERSION=$(grep -m 1 "^version = " crates/code_assistant/Cargo.toml | sed 's/version = "\(.*\)"/\1/')
3131
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
3232
echo "Current version: $CURRENT_VERSION"
3333
@@ -66,19 +66,22 @@ jobs:
6666
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
6767
echo "Release version: $NEW_VERSION"
6868
69-
- name: Update Cargo.toml and Cargo.lock
69+
- name: Update Cargo.toml files in all crates
7070
run: |
71-
# Update version in Cargo.toml
72-
sed -i "s/^version = \"${{ steps.cargo_version.outputs.current_version }}\"/version = \"${{ steps.release_version.outputs.new_version }}\"/" Cargo.toml
73-
cat Cargo.toml | grep "^version = "
71+
# Update version in all crates
72+
for crate_toml in crates/*/Cargo.toml; do
73+
echo "Updating version in $crate_toml"
74+
sed -i "s/^version = \"${{ steps.cargo_version.outputs.current_version }}\"/version = \"${{ steps.release_version.outputs.new_version }}\"/" "$crate_toml"
75+
cat "$crate_toml" | grep "^version = "
76+
done
7477
75-
# Update Cargo.lock
76-
cargo update --package code-assistant
78+
# Update Cargo.lock for the entire workspace
79+
cargo update
7780
7881
- name: Commit and push version update
7982
run: |
80-
# Stage both Cargo.toml and Cargo.lock
81-
git add Cargo.toml Cargo.lock
83+
# Stage all changes
84+
git add crates/*/Cargo.toml Cargo.lock
8285
git commit -m "Bump version to ${{ steps.release_version.outputs.new_version }}"
8386
git push
8487

0 commit comments

Comments
 (0)