|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +packages=( |
| 4 | + "opentelemetry" |
| 5 | + "opentelemetry-http" |
| 6 | + "opentelemetry-semantic-conventions" |
| 7 | + "opentelemetry-jaeger-propagator" |
| 8 | + "opentelemetry-sdk" |
| 9 | + "opentelemetry-proto" |
| 10 | + "opentelemetry-otlp" |
| 11 | + "opentelemetry-stdout" |
| 12 | + "opentelemetry-jaeger" |
| 13 | + "opentelemetry-zipkin" |
| 14 | + "opentelemetry-prometheus" |
| 15 | + "opentelemetry-appender-log" |
| 16 | + "opentelemetry-appender-tracing" |
| 17 | + |
| 18 | + # Add more packages as needed, in the right order |
| 19 | +) |
| 20 | + |
| 21 | +# Set the current directory to one level above the scripts directory |
| 22 | +current_dir=$(pwd)/.. |
| 23 | +cd "$current_dir" # Change to the current directory |
| 24 | + |
| 25 | +# Iterate over the list of packages |
| 26 | +for package in "${packages[@]}"; do |
| 27 | + if [ -d "$package" ]; then |
| 28 | + echo "==================================================" |
| 29 | + echo "Processing package: $package" |
| 30 | + cd "$package" # Change to the directory of package |
| 31 | + |
| 32 | + # Extract the name and version from Cargo.toml |
| 33 | + name=$(grep -m1 '^name =' Cargo.toml | cut -d'"' -f2) |
| 34 | + version=$(grep -m1 '^version =' Cargo.toml | cut -d'"' -f2) |
| 35 | + |
| 36 | + if [[ -n "$name" && -n "$version" ]]; then |
| 37 | + echo "Found package $name with version $version" in cargo.toml |
| 38 | + |
| 39 | + # Tag the version in git |
| 40 | + tag="${name}-${version}" |
| 41 | + tag_message="${name} ${version} release." |
| 42 | + # uncomment the following lines after verifying all looks good. |
| 43 | + # git tag -a "$tag" -m "\"$tag_message\"" |
| 44 | + # git push origin "$tag" |
| 45 | + echo "git tag -a "$tag" -m "$tag_message"" |
| 46 | + |
| 47 | + # Run cargo publish |
| 48 | + # uncomment the following line after verifying all looks good. |
| 49 | + # cargo publish |
| 50 | + echo "Published $name $version" |
| 51 | + else |
| 52 | + echo "Error: Unable to extract name or version from Cargo.toml in $package" |
| 53 | + fi |
| 54 | + |
| 55 | + cd "$current_dir" # Return to the original directory |
| 56 | + echo "Sleeping for 15 seconds before next package..." |
| 57 | + sleep 15 # Sleep for 15 seconds to allow crates.io to index the previous package |
| 58 | + else |
| 59 | + echo "Skipping: $package is not a valid package directory." |
| 60 | + fi |
| 61 | +done |
| 62 | + |
| 63 | +echo "Finished publishing all packages." |
0 commit comments