forked from GlitterWare/Passy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_version.sh
executable file
·31 lines (25 loc) · 1.01 KB
/
update_version.sh
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
#! /bin/bash
export version=''
while read -r line; do
if [[ $line == *'version: '* ]]; then
export version=$(echo ${line:9:${#line}} | cut -d '+' -f1)
break
fi
done <'./pubspec.yaml'
if [[ ${#version} == 0 ]]; then
read -p '? Could not detect current version. Enter current version manually [Eg: 1.0.0]: ' version
else
echo 'INFO:Version detected:'$version
fi
export newVersion=''
read -p '? Enter new version [Default: '$version']: ' newVersion
if [[ ${#newVersion} == 0 ]]; then
newVersion=$version
fi
echo 'INFO:Changing version '$version' to '$newVersion
echo 'INFO:Changing version in `lib/passy_data/common.dart`.'
sed -i 's/passyVersion = '\'$version\'\;'/passyVersion = '\'$newVersion\'\;'/' ./lib/passy_data/common.dart
echo 'INFO:Changing version in `pubspec.yaml`.'
sed -i 's/version: '$version'/version: '$newVersion'/' ./pubspec.yaml
echo 'INFO:Changing version in AppStream metadata.'
sed -i 's/version="v'$version'"/version="v'$newVersion'"/' ./linux_assets/com.glitterware.passy.appdata.xml