mirror of
https://github.com/TrustTunnel/TrustTunnel.git
synced 2026-07-09 17:18:36 +00:00
Pull request #23: Add an increment version script and bamboo spec
Merge in ADGUARD-CORE-LIBS/vpn-libs-endpoint from feature/ci_increment_version to master
Squashed commit of the following:
commit f810cd5c4eb355625a38783cd6d8041a1bae8782
Author: Nikita Gorskikh <n.gorskikh@adguard.com>
Date: Thu Sep 15 17:22:04 2022 +0300
The less code the better
commit 4310178efeb99d4a08408330d0067dbee11cd1f1
Author: Nikita Gorskikh <n.gorskikh@adguard.com>
Date: Thu Sep 15 17:20:41 2022 +0300
Fix working directory name
commit dea67ddf76b6562afb29f51906f854a47218f59b
Author: Nikita Gorskikh <n.gorskikh@adguard.com>
Date: Thu Sep 15 16:27:47 2022 +0300
Add increment version script and bamboo spec
This commit is contained in:
parent
2200f83a36
commit
ee69c7aa9a
6 changed files with 151 additions and 1 deletions
36
scripts/increment_version.sh
Executable file
36
scripts/increment_version.sh
Executable file
|
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
increment_version() {
|
||||
major=${1%%.*}
|
||||
minor=$(echo ${1#*.} | sed -e "s/\.[0-9]*//")
|
||||
revision=${1##*.}
|
||||
echo ${major}.${minor}.$((revision+1))
|
||||
}
|
||||
|
||||
VERSION=$(cat ./src/main.rs | grep "const VERSION_STRING" | tail -n 1 | sed -e 's/const VERSION_STRING: &str = "\(.*\)";/\1/')
|
||||
|
||||
argument_version=$1
|
||||
if [ -z "$argument_version" ]
|
||||
then
|
||||
NEW_VERSION=$(increment_version ${VERSION})
|
||||
else
|
||||
NEW_VERSION=$1
|
||||
fi
|
||||
|
||||
if ! [[ "${NEW_VERSION}" =~ ^[0-9]\.[0-9].[0-9]*$ ]]
|
||||
then
|
||||
echo "New version is invalid: ${NEW_VERSION}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Last version was ${VERSION}"
|
||||
echo "New version is ${NEW_VERSION}"
|
||||
|
||||
set -x
|
||||
|
||||
sed -i -e "s/^const VERSION_STRING: \&str = \".*\";$/const VERSION_STRING: \&str = \"${NEW_VERSION}\";/" src/main.rs
|
||||
|
||||
# Update changelog
|
||||
sed -i -e '3{s/##/##/;t;s/^/## '${NEW_VERSION}'\n\n/}' CHANGELOG.md
|
||||
Loading…
Add table
Add a link
Reference in a new issue