File: publish.sh

package info (click to toggle)
rust-test-case 3.3.1-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 544 kB
  • sloc: sh: 33; makefile: 4
file content (49 lines) | stat: -rwxr-xr-x 1,230 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/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)

cd "${REPO_DIR}"

set -eo xtrace

# 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

# 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

# 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

set +o xtrace

echo "Next step: Wait for CI"
echo "Next step: \`git tag vX.Y.Z; git push --tags\`"
echo "Next step: Create release in Github"
echo "Next step: \`cargo publish\`"

cd "${CURRENT_DIR}"