This repository was archived by the owner on Feb 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathbuild-release
More file actions
executable file
·67 lines (56 loc) · 1.91 KB
/
build-release
File metadata and controls
executable file
·67 lines (56 loc) · 1.91 KB
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
66
67
#!/bin/bash
set -euo pipefail
marketing_version=1.0.3
build_version=1
function full_path_of_directory() {
local directory_name
directory_name="$1"
current_directory=$(pwd)
while [[ "$(basename "$current_directory")" != "$directory_name" && ${#current_directory} -gt 1 ]]
do
current_directory=$(dirname "$current_directory")
done
if (( ${#current_directory} <= 1 ))
then
echo ">>> Error: Path of '$1' not found." 1>&2
kill -9 -- $$
exit 1
fi
echo "$current_directory"
}
function update_version() {
local project="$1"
plutil -replace CFBundleShortVersionString -string "$marketing_version" \
"${project_directory}"/"${project}"/Info.plist
plutil -replace CFBundleVersion -string "$build_version" \
"${project_directory}"/"${project}"/Info.plist
}
project_directory="$(full_path_of_directory xcode-github)"
cd "$project_directory"
build_products_directory="$project_directory"/Products
rm -Rf "$build_products_directory"
mkdir -p "$build_products_directory"
# PROJECT_TEMP_DIR - Intermediate build files.
# CONFIGURATION_BUILD_DIR - Built related files.
# BUILT_PRODUCTS_DIR - Deployed build products.
function build_project() {
local project="$1"
update_version "$project"
xcodebuild \
-project "${project}".xcodeproj \
-scheme "${project}" \
-quiet clean build \
CONFIGURATION_BUILD_DIR="$build_products_directory"
}
build_project XcodeGitHub
build_project xcode-github-cli
build_project xcode-github-app
rm -Rf "$build_products_directory"/libXcodeGitHub.a
rm -Rf "$build_products_directory"/usr
echo ">>> Build ${marketing_version}(${build_version}) products in 'Products':"
ls -al Products
git add --all
git commit --allow-empty -m "Release ${marketing_version}."
git tag v"${marketing_version}"
git_branch=$(git symbolic-ref --short HEAD)
git push --tags origin "$git_branch"