Skip to content

Commit

Permalink
publishing fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zachschuermann committed Jan 11, 2025
1 parent e6aefda commit b57acf9
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ is_working_tree_clean() {
is_version_published() {
local crate_name="$1"
local version
version=get_current_version "$crate_name"
version=$(get_current_version "$crate_name")

if [[ -z "$version" ]]; then
log_error "Could not find crate '$crate_name' in workspace"
Expand Down Expand Up @@ -122,14 +122,20 @@ handle_release_branch() {
# Handle main branch workflow (publish and tag)
handle_main_branch() {
# could potentially just use full 'cargo release' command here
publish "delta_kernel_derive" "$current_version"
publish "delta_kernel" "$current_version"
publish "delta_kernel_derive"
publish "delta_kernel"

# hack: just redo getting the version
local version
version=$(get_current_version "delta_kernel")

if confirm "Would you like to tag this release?"; then
log_info "Tagging release $current_version..."
git tag -a "v$current_version" -m "Release $current_version"
git push upstream "v$current_version"
log_success "Tagged release $current_version"
log_info "Tagging release $version..."
if confirm "Tagging as v$version. continue?"; then
git tag -a "v$version" -m "Release v$version"
git push upstream tag "v$version"
log_success "Tagged release $version"
fi
fi
}

Expand All @@ -138,20 +144,20 @@ publish() {
local current_version
current_version=$(get_current_version "$crate_name")

if is_version_published "delta_kernel_derive"; then
log_error "delta_kernel_derive version $current_version is already published to crates.io"
if is_version_published "$crate_name"; then
log_error "$crate_name version $current_version is already published to crates.io"
fi
log_info "[DRY RUN] Publishing $crate_name version $version to crates.io..."
log_info "[DRY RUN] Publishing $crate_name version $current_version to crates.io..."
if ! cargo publish --dry-run -p "$crate_name"; then
log_error "Failed to publish $crate_name to crates.io"
fi

if confirm "Dry run complete. Continue with publishing?"; then
log_info "Publishing $crate_name version $version to crates.io..."
log_info "Publishing $crate_name version $current_version to crates.io..."
if ! cargo publish -p "$crate_name"; then
log_error "Failed to publish $crate_name to crates.io"
fi
log_success "Successfully published $crate_name version $version to crates.io"
log_success "Successfully published $crate_name version $current_version to crates.io"
fi
}

Expand Down

0 comments on commit b57acf9

Please sign in to comment.