Skip to content

Commit

Permalink
chore: Update crate publishing script
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-biel committed Nov 17, 2023
1 parent b0a764f commit 21212e2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
29 changes: 22 additions & 7 deletions scripts/publish.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/usr/bin/env bash

# Publish a new version of the crate.
#
# Dependencies:
# - cargo-get
# - nvim

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
REPO_DIR="${SCRIPT_DIR}/.."
CURRENT_DIR=$(pwd)
Expand All @@ -8,18 +14,27 @@ cd "${REPO_DIR}"

set -eo xtrace

./scripts/test_all.sh
# Read current version from the Cargo.toml file
CURRENT_VERSION=$(cargo get package.version)
echo "Current version: ${CURRENT_VERSION}"
read -p 'New version: ' NEW_VERSION

nvim Cargo.toml
nvim crates/test-case-macros/Cargo.toml
nvim crates/test-case-core/Cargo.toml
cargo build
# Update version in Cargo.toml files
sed -i '' "s/version = \"${CURRENT_VERSION}\"/version = \"${NEW_VERSION}\"/g" Cargo.toml
sed -i '' "s/version = \"${CURRENT_VERSION}\"/version = \"${NEW_VERSION}\"/g" crates/test-case-macros/Cargo.toml
sed -i '' "s/version = \"${CURRENT_VERSION}\"/version = \"${NEW_VERSION}\"/g" crates/test-case-core/Cargo.toml

nvim CHANGELOG.md
nvim src/lib.rs
# Validate the release
rustup update
./scripts/test_all.sh

# Update README if needed
cargo readme > README.md

# Add changelog entry
nvim CHANGELOG.md

# Push to github
git add .
git commit
git push origin
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//!
//! ```toml
//! [dev-dependencies]
//! test-case = "3.2.1"
//! test-case = "*"
//! ```
//!
//! and imported to the scope of a block where it's being called
Expand Down

0 comments on commit 21212e2

Please sign in to comment.