forked from MonitorControl/MonitorControl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathset-version.sh
More file actions
executable file
·34 lines (25 loc) · 888 Bytes
/
Copy pathset-version.sh
File metadata and controls
executable file
·34 lines (25 loc) · 888 Bytes
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
#!/bin/zsh
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_FILE="${ROOT_DIR}/MonitorControl.xcodeproj/project.pbxproj"
RELEASE_TEMPLATE="${ROOT_DIR}/RELEASE_TEMPLATE.md"
version="${1:-}"
if [[ -z "${version}" ]]; then
printf "Enter the new version (for example 1.1.0): "
read -r version
fi
if [[ ! "${version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Invalid version: ${version}"
echo "Expected format: MAJOR.MINOR.PATCH"
exit 1
fi
if [[ ! -f "${PROJECT_FILE}" ]]; then
echo "Could not find project file: ${PROJECT_FILE}"
exit 1
fi
perl -0pi -e "s/MARKETING_VERSION = [^;]+;/MARKETING_VERSION = ${version};/g" "${PROJECT_FILE}"
if [[ -f "${RELEASE_TEMPLATE}" ]]; then
perl -0pi -e 's/`LumaGlass [^`]+`/`LumaGlass '"${version}"'`/' "${RELEASE_TEMPLATE}"
fi
echo "Updated MARKETING_VERSION to ${version}"
echo "Project file: ${PROJECT_FILE}"