File tree Expand file tree Collapse file tree 4 files changed +75
-22
lines changed
Expand file tree Collapse file tree 4 files changed +75
-22
lines changed Original file line number Diff line number Diff line change 11[package ]
22name = " stitch-sync"
3- version = " 0.1.2 "
3+ version = " 0.1.3 "
44edition = " 2021"
55authors = [" Oliver Steele <steele@osteele.com>" ]
66description = " Automatically convert embroidery files and optionally copy them to a USB drive"
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Strict error handling
4+ set -euo pipefail
5+ IFS=$' \n\t '
6+
7+ # Parse command line arguments
8+ BUMP_TYPE=" patch"
9+
10+ while [[ $# -gt 0 ]]; do
11+ case $1 in
12+ --major)
13+ BUMP_TYPE=" major"
14+ shift
15+ ;;
16+ --minor)
17+ BUMP_TYPE=" minor"
18+ shift
19+ ;;
20+ --patch)
21+ BUMP_TYPE=" patch"
22+ shift
23+ ;;
24+ * )
25+ echo " Unknown option: $1 "
26+ echo " Usage: $0 [--major|--minor|--patch]"
27+ exit 1
28+ ;;
29+ esac
30+ done
31+
32+ # Read current version from Cargo.toml
33+ CURRENT_VERSION=$( grep ' ^version = ' Cargo.toml | sed ' s/version = "\(.*\)"/\1/' )
34+ if [ -z " $CURRENT_VERSION " ]; then
35+ echo " Failed to determine current version from Cargo.toml"
36+ exit 1
37+ fi
38+
39+ # Split version into components
40+ IFS=' .' read -r MAJOR MINOR PATCH <<< " $CURRENT_VERSION"
41+
42+ # Bump version according to type
43+ case $BUMP_TYPE in
44+ major)
45+ NEW_VERSION=" $(( MAJOR + 1 )) .0.0"
46+ ;;
47+ minor)
48+ NEW_VERSION=" ${MAJOR} .$(( MINOR + 1 )) .0"
49+ ;;
50+ patch)
51+ NEW_VERSION=" ${MAJOR} .${MINOR} .$(( PATCH + 1 )) "
52+ ;;
53+ esac
54+
55+ # Update version in Cargo.toml using perl
56+ perl -i -pe " s/^version = \" .*\" /version = \" $NEW_VERSION \" /" Cargo.toml
57+
58+ # Verify the update was successful
59+ NEW_VERSION_CHECK=$( grep ' ^version = ' Cargo.toml | sed ' s/version = "\(.*\)"/\1/' )
60+ if [ " $NEW_VERSION_CHECK " != " $NEW_VERSION " ]; then
61+ echo " Failed to update version in Cargo.toml"
62+ exit 1
63+ fi
64+
65+ echo " Version bumped from $CURRENT_VERSION to $NEW_VERSION "
Original file line number Diff line number Diff line change 11#! /bin/bash
22
3+ # Strict error handling
4+ set -euo pipefail
5+ IFS=$' \n\t '
6+
37# Parse command line arguments
48ALLOW_DIRTY=false
59FORCE=false
@@ -39,30 +43,14 @@ if ! cargo test; then
3943 exit 1
4044fi
4145
42- # Get latest release info from GitHub API
43- echo " Fetching latest release information..."
44- RELEASE_INFO=$( curl -s " https://api.github.com/repos/${REPO_WITH_OWNER} /releases/latest" )
45- if [ $? -ne 0 ]; then
46- echo " Failed to fetch release information"
47- exit 1
48- fi
49-
50- # Extract current version tag
51- CURRENT_VERSION=$( echo " $RELEASE_INFO " | grep -o ' "tag_name": "[^"]*' | cut -d' "' -f4)
46+ # Read version from Cargo.toml
47+ CURRENT_VERSION=$( grep ' ^version = ' Cargo.toml | sed ' s/version = "\(.*\)"/\1/' )
5248if [ -z " $CURRENT_VERSION " ]; then
53- echo " Failed to determine latest version"
49+ echo " Failed to determine current version from Cargo.toml "
5450 exit 1
5551fi
5652
57- # Remove 'v' prefix if present
58- CURRENT_VERSION=${CURRENT_VERSION# v}
59-
60- # Split version into components
61- IFS=' .' read -r MAJOR MINOR PATCH <<< " $CURRENT_VERSION"
62-
63- # Increment patch version
64- NEW_PATCH=$(( PATCH + 1 ))
65- NEW_VERSION=" v${MAJOR} .${MINOR} .${NEW_PATCH} "
53+ NEW_VERSION=" v${CURRENT_VERSION} "
6654
6755# Prepare tag command
6856TAG_CMD=" git tag"
You can’t perform that action at this time.
0 commit comments