Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: release script publishing fixes #638

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading