File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -205,9 +205,19 @@ jobs:
205205        env :
206206          NEW_VERSION : ${{ steps.next_version.outputs.new_version }} 
207207        run : | 
208-           # Update workspace version 
209-           sed -i.bak "s/^version = \".*\"/version = \"$NEW_VERSION\"/" Cargo.toml 
210-           rm Cargo.toml.bak 
208+           # Update only the workspace version (first occurrence under [workspace.package]) 
209+           # Use awk to only replace the version in the [workspace.package] section 
210+           awk -v new_ver="$NEW_VERSION" ' 
211+             /^\[workspace\.package\]/ { in_workspace=1 } 
212+             /^\[/ && !/^\[workspace\.package\]/ { in_workspace=0 } 
213+             in_workspace && /^version = / && !replaced { 
214+               print "version = \"" new_ver "\"" 
215+               replaced=1 
216+               next 
217+             } 
218+             { print } 
219+           ' Cargo.toml > Cargo.toml.tmp 
220+           mv Cargo.toml.tmp Cargo.toml 
211221
212222          echo "Updated Cargo.toml to version $NEW_VERSION" 
213223          git diff Cargo.toml 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments