forked from samcallear/EPSRgui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchangeversion
executable file
·66 lines (58 loc) · 2.52 KB
/
changeversion
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
# Change the version of the source code to the supplied value
# Check that a version information was correctly supplied
if [ "$#" -eq "0" ]
then
echo "Checking current version numbers only..."
TEST="true"
elif [ "$1" = "bump" ]
then
echo "Bumping version number..."
# Get current version number from the Win32 iss file
MAJOR=`grep 'define MyAppVersion' extra/Win32/EPSRgui.iss | sed -e 's/#define MyAppVersion \"\([0-9]\)\..*\".*/\1/g'`
MINOR=`grep 'define MyAppVersion' extra/Win32/EPSRgui.iss | sed -e 's/#define MyAppVersion \"[0-9]\.\([0-9]\).*\".*/\1/g'`
PATCH=`grep 'define MyAppVersion' extra/Win32/EPSRgui.iss | sed -e 's/#define MyAppVersion \"[0-9]\.[0-9]\.\([0-9]*\)\".*/\1/g'`
echo "Current version is $MAJOR.$MINOR.$PATCH"
PATCH=$(($PATCH+1))
echo "New version will be $MAJOR.$MINOR.$PATCH"
TEST="false"
elif [ "$#" -ne "3" ]
then
echo "Improper version number supplied (use 'changeversion MAJOR MINOR PATCH', 'bump' to increase patch number, or no args to check existing files)"
exit 1
else
MAJOR=$1
MINOR=$2
PATCH=$3
TEST="false"
echo "Changing version numbers in files (to ${MAJOR}.${MINOR}.{$PATCH}..."
fi
# Create git tag
if [ "$TEST" = "false" ]
then
git tag -a $MAJOR.$MINOR.$PATCH -m "change version to $MAJOR.$MINOR.$PATCH"
fi
# OSX build files
echo -n " EPSRgui.dmginfo (Program Version) : "
if [ "$TEST" = "false" ]
then
sed -i -e "s/APP_VERSION=\"\([0-9a-z\.]\+\)\"/APP_VERSION=\"$MAJOR.$MINOR.$PATCH\"/g" ./extra/OSX/EPSRgui.dmginfo
fi
grep 'APP_VERSION=' ./extra/OSX/EPSRgui.dmginfo | sed -e 's/APP_VERSION=\"\([0-9a-z\.]\+\)\"/\1/g'
# Windows build files
if [ "$TEST" = "false" ]
then
sed -i -e "s/#define MyAppVersion \"[0-9\.]*\"/#define MyAppVersion \"$MAJOR.$MINOR.$PATCH\"/g" -e "s/OutputBaseFilename=EPSRgui-[0-9\.]*/OutputBaseFilename=EPSRgui-$MAJOR.$MINOR.$PATCH/g" extra/Win32/EPSRgui.iss
fi
echo -n " EPSRgui.iss (Program Version) : "
grep 'define MyAppVersion' extra/Win32/EPSRgui.iss | sed -e 's/#define MyAppVersion \"\([0-9\.]*\)\"/\1/g'
echo -n " EPSRgui.iss (Output Filename) : "
grep 'OutputBaseFilename' extra/Win32/EPSRgui.iss | sed -e 's/OutputBaseFilename=EPSRgui-\([0-9\.]*\)/\1/g'
# AppImage build files
if [ "$TEST" = "false" ]
then
sed -i -e "s/Version=[0-9\.]*/Version=$MAJOR.$MINOR.$PATCH/g" extra/appimage/usr/share/applications/com.projectaten.EPSRgui.desktop
fi
echo -n "appimage.desktop (Program Version) : "
grep 'Version=' extra/appimage/usr/share/applications/com.projectaten.EPSRgui.desktop | sed -e 's/Version=\([0-9\.]*\)/\1/g'
exit 0