Skip to content

Commit 48dd1b7

Browse files
authored
[PM-18414] CI restructuring #4 - Consolidate build.sh (#1526)
1 parent cfffeee commit 48dd1b7

File tree

4 files changed

+27
-60
lines changed

4 files changed

+27
-60
lines changed

.github/workflows/build-bwa.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ jobs:
158158
- name: Build iOS app
159159
run: |
160160
BUILD_NUMBER=$(($GITHUB_RUN_NUMBER))
161-
./Scripts-bwa/build.sh
161+
./Scripts/build.sh project-bwa.yml Authenticator Device
162162
163163
- name: Upload IPA
164164
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ jobs:
358358
359359
- name: Build iOS app
360360
run: |
361-
./Scripts/build.sh ${{ env._BUILD_MODE }}
361+
./Scripts/build.sh project-pm.yml Bitwarden ${{ env._BUILD_MODE }}
362362
363363
- name: Prepare artifacts for upload to GitHub
364364
run: |

Scripts-bwa/build.sh

Lines changed: 0 additions & 44 deletions
This file was deleted.

Scripts/build.sh

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,51 @@
66
#
77
# Usage:
88
#
9-
# $ ./Scripts/build.sh <build_mode>
9+
# $ ./Scripts/build.sh <project_file> <build_scheme> <build_mode>
1010
#
11-
# Where mode is one of:
12-
# - Device: Build for physical iOS devices
13-
# - Simulator: Build for iOS Simulator
11+
# Where:
12+
# - project_file: Path to the project file (i.e., project-pm.yml or project-bwa.yml)
13+
# - build_scheme: Build scheme (i.e., Bitwarden or Authenticator)
14+
# - build_mode is one of:
15+
# - Device: Build for physical iOS devices
16+
# - Simulator: Build for iOS Simulator
17+
#
18+
# Examples:
19+
# $ ./Scripts/build.sh project-pm.yml Bitwarden Simulator
20+
# $ ./Scripts/build.sh project-bwa.yml Authenticator Device
1421

1522
set -euo pipefail
1623

1724
bold=$(tput -T ansi bold)
1825
normal=$(tput -T ansi sgr0)
1926

20-
if [ $# -lt 1 ]; then
21-
echo >&2 "Called without necessary arguments: ${bold}mode${normal}"
22-
echo >&2 "For example: \`Scripts/build.sh Simulator"
27+
if [ $# -lt 3 ]; then
28+
echo >&2 "Called without necessary arguments: ${bold}project_file build_scheme build_mode${normal}"
29+
echo >&2 "For example: \`Scripts/build.sh project-pm.yml Bitwarden Simulator\`"
2330
exit 1
2431
fi
2532

26-
MODE=$1
33+
PROJECT_FILE=$1
34+
BUILD_SCHEME=$2
35+
MODE=$3
2736

2837
BUILD_DIR="build"
2938
DERIVED_DATA_PATH="${BUILD_DIR}/DerivedData"
30-
ARCHIVE_PATH="${BUILD_DIR}/Bitwarden.xcarchive"
31-
EXPORT_PATH="${BUILD_DIR}/Bitwarden"
39+
ARCHIVE_PATH="${BUILD_DIR}/${BUILD_SCHEME}.xcarchive"
40+
EXPORT_PATH="${BUILD_DIR}/${BUILD_SCHEME}"
3241

3342
echo "🧱 Building in ${bold}$(pwd)${normal}"
34-
echo "🧱 Using build mode of ${bold}${MODE}${normal}."
43+
echo "🧱 Project file ${bold}${PROJECT_FILE}${normal}"
44+
echo "🧱 Build Scheme ${bold}${BUILD_SCHEME}${normal}"
45+
echo "🧱 Using build mode of ${bold}${MODE}${normal}"
3546
echo "🧱 Derived Data path ${bold}${DERIVED_DATA_PATH}${normal}"
3647
echo "🧱 Archive path ${bold}${ARCHIVE_PATH}${normal}"
3748
echo "🧱 Export path ${bold}${EXPORT_PATH}${normal}"
3849
echo ""
3950

4051
echo "🌱 Generating Xcode projects"
4152
mint run xcodegen --spec "project-bwk.yml"
42-
mint run xcodegen --spec "project-pm.yml"
53+
mint run xcodegen --spec "${PROJECT_FILE}"
4354
echo ""
4455

4556
mkdir -p "${BUILD_DIR}"
@@ -49,7 +60,7 @@ case "$MODE" in
4960
echo "🔨 Performing Xcode build"
5061
xcrun xcodebuild \
5162
-workspace Bitwarden.xcworkspace \
52-
-scheme Bitwarden \
63+
-scheme "${BUILD_SCHEME}" \
5364
-configuration Debug \
5465
-destination "generic/platform=iOS Simulator" \
5566
-derivedDataPath "${DERIVED_DATA_PATH}" \
@@ -59,7 +70,7 @@ case "$MODE" in
5970
echo "📦 Performing Xcode archive"
6071
xcrun xcodebuild archive \
6172
-workspace Bitwarden.xcworkspace \
62-
-scheme Bitwarden \
73+
-scheme "${BUILD_SCHEME}" \
6374
-configuration Release \
6475
-archivePath "${ARCHIVE_PATH}" \
6576
-derivedDataPath "${DERIVED_DATA_PATH}" \

0 commit comments

Comments
 (0)