44 workflow_dispatch :
55 inputs :
66 package_path :
7- description : ' Comma-separated list of crates to publish. Example: core,restaking_core,cli'
7+ description : " Comma-separated list of crates to publish. Example: core,restaking_core,cli"
88 required : true
9- default : ' account_traits_derive,bytemuck, clients/rust/common,clients/rust/restaking_client,clients/rust/vault_client,core,restaking_sdk,restaking_core,restaking_program,vault_sdk,vault_core,vault_program'
9+ default : " clients/rust/common,clients/rust/restaking_client,clients/rust/vault_client,core,restaking_sdk,restaking_core,restaking_program,vault_sdk,vault_core,vault_program"
1010 type : string
1111 level :
1212 description : Version increment level for selected crates
1818 - minor
1919 - major
2020 tag_name :
21- description : ' Custom tag name for release. Example: v1.2.3 or release-2024-01'
21+ description : " Custom tag name for release. Example: v1.2.3 or release-2024-01"
2222 required : true
2323 type : string
2424 dry_run :
4646 run : |
4747 # All available crates in dependency order
4848 ALL_CRATES=(
49- "account_traits_derive"
50- "bytemuck"
5149 "clients/rust/common"
5250 "clients/rust/restaking_client"
5351 "clients/rust/vault_client"
5957 "vault_core"
6058 "vault_program"
6159 )
62-
60+
6361 # Check if input contains commas (multiple crates) or is "all"
6462 if [[ "${{ inputs.package_path }}" == "all" ]]; then
6563 # Publish all crates
7068 # Multiple crates - parse comma-separated list
7169 IFS=',' read -ra SELECTED_ARRAY <<< "${{ inputs.package_path }}"
7270 CRATES_TO_PUBLISH=()
73-
71+
7472 # Validate and order selected crates according to dependency order
7573 for crate in "${ALL_CRATES[@]}"; do
7674 for selected in "${SELECTED_ARRAY[@]}"; do
8280 fi
8381 done
8482 done
85-
83+
8684 echo "📦 Publishing MULTIPLE crates: ${{ inputs.package_path }}"
8785 IS_SINGLE="false"
8886 else
@@ -91,15 +89,15 @@ jobs:
9189 echo "📦 Publishing SINGLE crate: ${{ inputs.package_path }}"
9290 IS_SINGLE="true"
9391 fi
94-
92+
9593 # Convert to space-separated string for output
9694 CRATES_STRING=$(IFS=' '; echo "${CRATES_TO_PUBLISH[*]}")
9795 COUNT=${#CRATES_TO_PUBLISH[@]}
98-
96+
9997 echo "crates_to_publish=$CRATES_STRING" >> $GITHUB_OUTPUT
10098 echo "crate_count=$COUNT" >> $GITHUB_OUTPUT
10199 echo "is_single_crate=$IS_SINGLE" >> $GITHUB_OUTPUT
102-
100+
103101 echo "Will publish $COUNT crates: $CRATES_STRING"
104102 echo "Is single crate: $IS_SINGLE"
105103
@@ -208,52 +206,52 @@ jobs:
208206 run : |
209207 # Convert space-separated string back to array
210208 read -ra CRATES_TO_PUBLISH <<< "${{ needs.determine_crates.outputs.crates_to_publish }}"
211-
209+
212210 PUBLISHED_CRATES=""
213-
211+
214212 # Determine the version level to use
215213 LEVEL="${{ inputs.level }}"
216-
214+
217215 for crate_path in "${CRATES_TO_PUBLISH[@]}"; do
218216 echo "========================================="
219217 echo "Publishing $crate_path..."
220218 echo "========================================="
221219 cd "$GITHUB_WORKSPACE/$crate_path"
222-
220+
223221 # Get versions
224222 OLD_VERSION=$(grep -m1 'version =' Cargo.toml | cut -d '"' -f2)
225223 CRATE_NAME=$(basename "$crate_path")
226-
224+
227225 echo "Current version: $OLD_VERSION"
228-
226+
229227 if [ "${{ inputs.dry_run }}" == "true" ]; then
230228 echo "🧪 DRY RUN: Would publish $CRATE_NAME $LEVEL"
231229 cargo release $LEVEL --no-confirm --no-push
232230 else
233231 echo "🚀 Publishing $CRATE_NAME $LEVEL"
234232 cargo release $LEVEL --no-confirm -x
235-
233+
236234 # Wait a bit between publishes to avoid rate limits (only for multiple crates)
237235 if [ "${{ needs.determine_crates.outputs.is_single_crate }}" == "false" ]; then
238236 echo "⏳ Waiting 10 seconds before next publish..."
239237 sleep 10
240238 fi
241239 fi
242-
240+
243241 NEW_VERSION=$(grep -m1 'version =' Cargo.toml | cut -d '"' -f2)
244242 echo "New version: $NEW_VERSION"
245-
243+
246244 # Track published crates for summary
247245 PUBLISHED_CRATES="${PUBLISHED_CRATES}- **${CRATE_NAME}**: ${OLD_VERSION} → ${NEW_VERSION}\n"
248-
246+
249247 echo "✅ Completed $CRATE_NAME"
250248 cd "$GITHUB_WORKSPACE"
251249 done
252-
250+
253251 echo "published_crates<<EOF" >> $GITHUB_OUTPUT
254252 echo -e "$PUBLISHED_CRATES" >> $GITHUB_OUTPUT
255253 echo "EOF" >> $GITHUB_OUTPUT
256-
254+
257255 echo "========================================="
258256 echo "🎉 Publishing completed!"
259257 echo "========================================="
@@ -276,12 +274,12 @@ jobs:
276274 run : |
277275 # Convert space-separated string back to array
278276 read -ra CRATES_TO_PUBLISH <<< "${{ needs.determine_crates.outputs.crates_to_publish }}"
279-
277+
280278 # Determine release info based on what was published
281279 TIMESTAMP=$(date +%Y%m%d-%H%M%S)
282280 CRATE_COUNT=${{ needs.determine_crates.outputs.crate_count }}
283281 TAG_NAME=${{ github.event.inputs.tag_name }}
284-
282+
285283 if [ "${{ needs.determine_crates.outputs.is_single_crate }}" == "true" ]; then
286284 # Single crate release
287285 CRATE_PATH="${CRATES_TO_PUBLISH[0]}"
@@ -294,9 +292,9 @@ jobs:
294292 # Multiple crates release
295293 RELEASE_TITLE="Jito Restaking Release - $(date +%Y-%m-%d)"
296294 fi
297-
295+
298296 echo "Creating combined release: $RELEASE_TITLE"
299-
297+
300298 # Build release notes
301299 RELEASE_NOTES="## $RELEASE_TITLE
302300
@@ -307,39 +305,39 @@ jobs:
307305 ### 📝 What's Changed
308306
309307 Recent changes across all published crates:"
310-
308+
311309 # Generate combined changelog
312310 COMBINED_CHANGELOG=""
313311 for crate_path in "${CRATES_TO_PUBLISH[@]}"; do
314312 CRATE_NAME=$(basename "$crate_path")
315313 echo "Generating changelog for $CRATE_NAME..."
316-
314+
317315 # Get recent commits for this crate
318316 CRATE_CHANGELOG=$(git log --pretty=format:'- %s' --no-merges $(git describe --tags --abbrev=0 2>/dev/null || echo "")..HEAD -- "$crate_path" | head -5)
319-
317+
320318 if [ -n "$CRATE_CHANGELOG" ]; then
321319 COMBINED_CHANGELOG="$COMBINED_CHANGELOG
322320
323321 #### $CRATE_NAME
324322 $CRATE_CHANGELOG"
325323 fi
326324 done
327-
325+
328326 if [ -z "$COMBINED_CHANGELOG" ]; then
329327 COMBINED_CHANGELOG="
330328 - Published new versions of selected crates"
331329 fi
332-
330+
333331 RELEASE_NOTES="$RELEASE_NOTES$COMBINED_CHANGELOG
334332
335333 **Full Changelog**: https://github.com/${{ github.repository }}/commits/$TAG_NAME"
336-
334+
337335 # Create the combined GitHub release
338336 gh release create "$TAG_NAME" \
339337 --title "$RELEASE_TITLE" \
340338 --notes "$RELEASE_NOTES" \
341339 --latest=true
342-
340+
343341 echo "✅ Created combined release: $TAG_NAME"
344342 env :
345343 GH_TOKEN : ${{ secrets.JITO_TEAM_PAT }}
@@ -360,18 +358,18 @@ jobs:
360358 echo "- **Dry run**: ${{ inputs.dry_run }}" >> $GITHUB_STEP_SUMMARY
361359 echo "- **Version level**: ${{ inputs.level }}" >> $GITHUB_STEP_SUMMARY
362360 echo "" >> $GITHUB_STEP_SUMMARY
363-
361+
364362 if [ "${{ inputs.dry_run }}" == "true" ]; then
365363 echo "⚠️ **This was a dry run - no actual publishing occurred**" >> $GITHUB_STEP_SUMMARY
366364 else
367365 echo "✅ **Publishing completed successfully!**" >> $GITHUB_STEP_SUMMARY
368-
366+
369367 if [ "${{ inputs.create_release }}" == "true" ]; then
370368 echo "🏷️ **Combined GitHub release created**" >> $GITHUB_STEP_SUMMARY
371369 fi
372370 fi
373-
371+
374372 echo "" >> $GITHUB_STEP_SUMMARY
375373 echo "### 📋 Published Crates" >> $GITHUB_STEP_SUMMARY
376374 echo "" >> $GITHUB_STEP_SUMMARY
377- echo "${{ needs.publish.outputs.published_crates }}" >> $GITHUB_STEP_SUMMARY
375+ echo "${{ needs.publish.outputs.published_crates }}" >> $GITHUB_STEP_SUMMARY
0 commit comments