| 
4 | 4 |   push:  | 
5 | 5 |     branches:  | 
6 | 6 |       - main  | 
7 |  | -      - pb/rust-release # for testing  | 
 | 7 | +      - pb/rust-release-cargo # for testing  | 
8 | 8 |     paths:  | 
9 | 9 |       - 'rust/main/**'  | 
10 | 10 |       - '.github/workflows/rust-release.yml'  | 
@@ -73,10 +73,10 @@ jobs:  | 
73 | 73 |         id: check_version  | 
74 | 74 |         working-directory: ./rust/main  | 
75 | 75 |         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/')  | 
78 | 78 |           echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT  | 
79 |  | -          echo "Current hyperlane-agents.version: $CURRENT_VERSION"  | 
 | 79 | +          echo "Current workspace version: $CURRENT_VERSION"  | 
80 | 80 | 
  | 
81 | 81 |           # Get latest agents-v* tag  | 
82 | 82 |           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:  | 
110 | 110 |       - uses: actions/checkout@v4  | 
111 | 111 |         with:  | 
112 | 112 |           fetch-depth: 0  | 
 | 113 | +      - uses: dtolnay/rust-toolchain@stable  | 
113 | 114 |       - name: Install git-cliff  | 
114 | 115 |         uses: taiki-e/install-action@v2  | 
115 | 116 |         with:  | 
@@ -205,9 +206,29 @@ jobs:  | 
205 | 206 |         env:  | 
206 | 207 |           NEW_VERSION: ${{ steps.next_version.outputs.new_version }}  | 
207 | 208 |         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  | 
211 | 232 | 
  | 
212 | 233 |           # Prepend new version to CHANGELOG.md  | 
213 | 234 |           if [ -f CHANGELOG.md ]; then  | 
@@ -243,7 +264,7 @@ jobs:  | 
243 | 264 |           git checkout -B "$BRANCH_NAME"  | 
244 | 265 | 
  | 
245 | 266 |           # 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  | 
247 | 268 | 
  | 
248 | 269 |           # Commit changes  | 
249 | 270 |           git commit -m "release: agents v${NEW_VERSION}  | 
 | 
0 commit comments