Skip to content

Commit fafc20c

Browse files
committed
cargoify it
1 parent ac993b7 commit fafc20c

File tree

5 files changed

+67
-47
lines changed

5 files changed

+67
-47
lines changed

.github/workflows/rust-release.yml

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
branches:
66
- main
7-
- pb/rust-release # for testing
7+
- pb/rust-release-cargo # for testing
88
paths:
99
- 'rust/main/**'
1010
- '.github/workflows/rust-release.yml'
@@ -73,10 +73,10 @@ jobs:
7373
id: check_version
7474
working-directory: ./rust/main
7575
run: |
76-
# Get current version from hyperlane-agents.version file
77-
CURRENT_VERSION=$(cat hyperlane-agents.version | tr -d '[:space:]')
76+
# Get current version from Cargo.toml workspace.package.version
77+
CURRENT_VERSION=$(grep -A 10 '^\[workspace\.package\]' Cargo.toml | grep '^version = ' | head -1 | sed 's/version = "\(.*\)"/\1/')
7878
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
79-
echo "Current hyperlane-agents.version: $CURRENT_VERSION"
79+
echo "Current workspace version: $CURRENT_VERSION"
8080
8181
# Get latest agents-v* tag
8282
LATEST_TAG=$(git tag -l "agents-v*" --sort=-version:refname | grep -E "^agents-v[0-9]+\.[0-9]+\.[0-9]+$" | head -1)
@@ -110,6 +110,7 @@ jobs:
110110
- uses: actions/checkout@v4
111111
with:
112112
fetch-depth: 0
113+
- uses: dtolnay/rust-toolchain@stable
113114
- name: Install git-cliff
114115
uses: taiki-e/install-action@v2
115116
with:
@@ -205,9 +206,29 @@ jobs:
205206
env:
206207
NEW_VERSION: ${{ steps.next_version.outputs.new_version }}
207208
run: |
208-
# Update hyperlane-agents.version file
209-
echo "$NEW_VERSION" > hyperlane-agents.version
210-
echo "Updated hyperlane-agents.version to $NEW_VERSION"
209+
# Update workspace version in Cargo.toml
210+
# Use awk to find [workspace.package] section and update version within it
211+
awk -v new_version="$NEW_VERSION" '
212+
/^\[workspace\.package\]/ { in_workspace=1 }
213+
/^\[/ && !/^\[workspace\.package\]/ { in_workspace=0 }
214+
in_workspace && /^version = / {
215+
print "version = \"" new_version "\""
216+
next
217+
}
218+
{ print }
219+
' Cargo.toml > Cargo.toml.new
220+
mv Cargo.toml.new Cargo.toml
221+
echo "Updated Cargo.toml workspace version to $NEW_VERSION"
222+
223+
# Update Cargo.lock in rust/main
224+
cargo update --workspace --offline 2>/dev/null || cargo update --workspace
225+
echo "Updated rust/main/Cargo.lock"
226+
227+
# Update Cargo.lock in rust/sealevel
228+
cd ../sealevel
229+
cargo update --workspace --offline 2>/dev/null || cargo update --workspace
230+
echo "Updated rust/sealevel/Cargo.lock"
231+
cd ../main
211232
212233
# Prepend new version to CHANGELOG.md
213234
if [ -f CHANGELOG.md ]; then
@@ -243,7 +264,7 @@ jobs:
243264
git checkout -B "$BRANCH_NAME"
244265
245266
# Stage changes
246-
git add rust/main/CHANGELOG.md rust/main/hyperlane-agents.version
267+
git add rust/main/CHANGELOG.md rust/main/Cargo.toml rust/main/Cargo.lock rust/sealevel/Cargo.lock
247268
248269
# Commit changes
249270
git commit -m "release: agents v${NEW_VERSION}

rust/main/Cargo.lock

Lines changed: 33 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/main/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ edition = "2021"
3333
homepage = "https://hyperlane.xyz"
3434
license-file = "../LICENSE.md"
3535
publish = false
36-
version = "0.1.0"
36+
version = "1.5.0"
3737

3838
[workspace.dependencies]
3939
Inflector = "0.11.4"

rust/main/hyperlane-agents.version

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)