mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-04 05:40:14 -05:00
Use dots in version
This commit is contained in:
parent
8639c8b479
commit
41e67f8beb
5 changed files with 25 additions and 40 deletions
18
autover.sh
18
autover.sh
|
|
@ -1,24 +1,30 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
|
||||
if [ -d .git ]; then
|
||||
# Get version from git tags, removing the 'v' prefix
|
||||
VERSION=$(git describe --match 'v*' 2>/dev/null | sed 's/^v//')
|
||||
fi
|
||||
|
||||
if [ -f .version ]; then
|
||||
# Get version from the .version file
|
||||
VERSION=$(cat .version)
|
||||
fi
|
||||
|
||||
if [ -z "$VERSION" ] && [ -d .git ]; then
|
||||
# Get version from git tags, removing the 'v' prefix
|
||||
VERSION=$(git describe --match 'v*' 2>/dev/null | sed 's/^v//')
|
||||
fi
|
||||
|
||||
if [ -z "$VERSION" ] && [ -d .git ]; then
|
||||
# Fall back to short commit hash
|
||||
VERSION=0-$(git rev-parse --short HEAD 2>/dev/null)
|
||||
fi
|
||||
|
||||
if [ -z $VERSION ]; then
|
||||
if [ -z "$VERSION" ]; then
|
||||
# No version, but still use a number
|
||||
VERSION="0"
|
||||
fi
|
||||
|
||||
# Apply common rules to all outputs:
|
||||
# 1. Replace "rc-" with "rc"
|
||||
# 2. Replace "beta-" with "beta"
|
||||
# 3. Replace all remaining dashes with "+"
|
||||
VERSION=$(echo "$VERSION" | sed 's/rc-/rc/g; s/beta-/beta/g; s/-/+/g')
|
||||
|
||||
printf '%s' "$VERSION"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue