|
10 | 10 | # set -x |
11 | 11 | set -euo pipefail |
12 | 12 |
|
13 | | -# Confirm we don't have unstaged changes |
14 | | -if ! git diff --exit-code > /dev/null; then |
15 | | - echo "Error: There are unstaged changes. Please commit or stash them before running this script." |
16 | | - exit 1 |
17 | | -fi |
18 | | - |
19 | | -# Confirm we are in the root of the directory |
20 | | - |
21 | | -pushd nym-vpn-desktop |
22 | | -pushd src-tauri |
23 | | -# Bump the patch level version |
24 | | -command="cargo set-version --bump patch" |
25 | | -# npm version patch |
26 | | -# cargo set-version 0.0.6-dev |
27 | | -# npm version 0.0.6-dev |
28 | | - |
29 | | -# Run the command with --dry-run option first |
30 | | -echo "Running in dry-run mode: $command --dry-run" |
31 | | -$command --dry-run |
32 | | - |
33 | | -# Ask for user confirmation |
34 | | -read -p "Was this the intended change? (Y/N): " answer |
35 | | -if [[ $answer =~ ^[Yy]$ ]]; then |
36 | | - echo "Running command without dry-run: $command" |
37 | | - $command |
38 | | -else |
39 | | - echo "Exiting without making changes." |
40 | | - exit 1 |
41 | | -fi |
42 | | - |
43 | | -popd |
44 | | - |
45 | | -# We can't run this with --dry-run, so let's assume it will be fine |
46 | | -command_npm="npm version patch" |
47 | | -echo "Running: $command_npm" |
48 | | -$command_npm |
49 | | - |
50 | | -# Read the new version |
51 | | -# version=$(cargo get package.version --entry="nym-vpn-desktop") |
52 | | -version=$(cargo get package.version --entry src-tauri) |
53 | | -tag_name=nym-vpn-desktop-v$version |
54 | | - |
55 | | -# Tag the release |
56 | | -read -p "Do you want to tag this commit with: $tag_name ? (Y/N): " confirm_tag |
57 | | -if [[ $confirm_tag =~ ^[Yy]$ ]]; then |
58 | | - echo "Tagging the commit with tag: $tag_name" |
59 | | - git commit -a -m "Bump nym-vpn-desktop to $version" |
60 | | - git tag $tag_name |
61 | | - # Optionally, push the tag to remote repository |
62 | | - # git push origin $tag |
63 | | -else |
64 | | - echo "Not tagging." |
65 | | -fi |
| 13 | +source "$(dirname "$0")/common.sh" |
| 14 | + |
| 15 | +NAME=nym-vpn-desktop |
| 16 | +DIRNAME=nym-vpn-desktop |
| 17 | + |
| 18 | +cargo_version_bump() { |
| 19 | + cd $DIRNAME/src-tauri |
| 20 | + local command="cargo set-version --bump patch" |
| 21 | + echo "Running in dry-run mode: $command --dry-run" |
| 22 | + $command --dry-run |
| 23 | + ask_for_confirmation "$command" |
| 24 | + cd ../.. |
| 25 | +} |
| 26 | + |
| 27 | +npm_version_bump() { |
| 28 | + # We can't run this with --dry-run, so let's assume it will be fine |
| 29 | + cd $DIRNAME |
| 30 | + local command_npm="npm version patch" |
| 31 | + echo "Running: $command_npm" |
| 32 | + $command_npm |
| 33 | + cd .. |
| 34 | +} |
| 35 | + |
| 36 | +tag_release() { |
| 37 | + cd $DIRNAME |
| 38 | + local version=$(cargo get package.version --entry src-tauri) |
| 39 | + local tag_name="$NAME-v$version" |
| 40 | + echo "New version: $version, Tag: $tag_name" |
| 41 | + ask_and_tag_release "$tag_name" "$version" |
| 42 | +} |
| 43 | + |
| 44 | +main() { |
| 45 | + check_unstaged_changes |
| 46 | + confirm_root_directory |
| 47 | + cargo_version_bump |
| 48 | + npm_version_bump |
| 49 | + tag_release |
| 50 | +} |
| 51 | + |
| 52 | +main |
0 commit comments