1
0
mirror of https://github.com/juzzlin/Heimer.git synced 2025-06-12 16:37:54 +08:00
Heimer/scripts/update-version
2020-08-12 22:46:59 +03:00

36 lines
1.2 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Updates Heimer version in all build and packaging scripts.
# Must be run in the project root.
VERSION_MAJOR=$1
VERSION_MINOR=$2
VERSION_PATCH=$3
if [[ ! $1 || ! $2 || ! $3 ]]; then
echo "Usage: $0 VERSION_MAJOR VERSION_MINOR VERSION_PATCH"
exit 1
fi
FILE=CMakeLists.txt
echo "Updating ${FILE} .."
sed -i "s/^set(VERSION_MAJOR.*/set(VERSION_MAJOR ${VERSION_MAJOR})/" ${FILE} || exit 1
sed -i "s/^set(VERSION_MINOR.*/set(VERSION_MINOR ${VERSION_MINOR})/" ${FILE} || exit 1
sed -i "s/^set(VERSION_PATCH.*/set(VERSION_PATCH ${VERSION_PATCH})/" ${FILE} || exit 1
FILE=packaging/windows/heimer.nsi
echo "Updating ${FILE} .."
sed -i "s/^!define VERSIONMAJOR.*/!define VERSIONMAJOR ${VERSION_MAJOR}/" ${FILE} || exit 1
sed -i "s/^!define VERSIONMINOR.*/!define VERSIONMINOR ${VERSION_MINOR}/" ${FILE} || exit 1
sed -i "s/^!define VERSIONBUILD.*/!define VERSIONBUILD ${VERSION_PATCH}/" ${FILE} || exit 1
for FILE in heimer.pro snapcraft.yaml scripts/build-app-image scripts/build-windows-zip; do
echo "Updating ${FILE} .."
sed -i -E "s/[0-9]+\.[0-9]+\.[0-9]+/$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH/" ${FILE} || exit 1
done
git diff
echo "Done."