diff --git a/.github/workflows/build-bwa.yml b/.github/workflows/build-bwa.yml index b8fb1bca2a..a0175c7f61 100644 --- a/.github/workflows/build-bwa.yml +++ b/.github/workflows/build-bwa.yml @@ -158,7 +158,7 @@ jobs: - name: Build iOS app run: | BUILD_NUMBER=$(($GITHUB_RUN_NUMBER)) - ./Scripts-bwa/build.sh + ./Scripts/build.sh project-bwa.yml Authenticator Device - name: Upload IPA uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6cdc46ca2f..6c0731028a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -358,7 +358,7 @@ jobs: - name: Build iOS app run: | - ./Scripts/build.sh ${{ env._BUILD_MODE }} + ./Scripts/build.sh project-pm.yml Bitwarden ${{ env._BUILD_MODE }} - name: Prepare artifacts for upload to GitHub run: | diff --git a/Scripts-bwa/build.sh b/Scripts-bwa/build.sh deleted file mode 100755 index 6fec27269b..0000000000 --- a/Scripts-bwa/build.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env bash -# -# Builds the Authenticator iOS app, and outputs an IPA file that can be uploaded to TestFlight. -# -# Usage: -# -# $ ./build.sh - -set -euo pipefail - -bold=$(tput -T ansi bold) -normal=$(tput -T ansi sgr0) - -BUILD_DIR="build" - -ARCHIVE_PATH="${BUILD_DIR}/Authenticator.xcarchive" -EXPORT_PATH="${BUILD_DIR}/Authenticator" - -echo "🧱 Building in $(pwd)" -echo "" - -echo "🌱 Generating xcode project" -mint run xcodegen --spec "project-bwk.yml" -mint run xcodegen --spec "project-bwa.yml" - -mkdir -p "${BUILD_DIR}" - -echo "🔨 Performing Xcode archive" -xcrun xcodebuild archive \ - -workspace Bitwarden.xcworkspace \ - -scheme Authenticator \ - -configuration Release \ - -archivePath "${ARCHIVE_PATH}" \ - | xcbeautify --renderer github-actions -echo "" - -echo "📦 Performing Xcode archive export" -xcrun xcodebuild -exportArchive \ - -archivePath "${ARCHIVE_PATH}" \ - -exportPath "${EXPORT_PATH}" \ - -exportOptionsPlist "Configs-bwa/export_options.plist" \ - | xcbeautify --renderer github-actions - -echo "🎉 Build complete" diff --git a/Scripts/build.sh b/Scripts/build.sh index 710cb61529..9277aeb204 100755 --- a/Scripts/build.sh +++ b/Scripts/build.sh @@ -6,32 +6,43 @@ # # Usage: # -# $ ./Scripts/build.sh +# $ ./Scripts/build.sh # -# Where mode is one of: -# - Device: Build for physical iOS devices -# - Simulator: Build for iOS Simulator +# Where: +# - project_file: Path to the project file (i.e., project-pm.yml or project-bwa.yml) +# - build_scheme: Build scheme (i.e., Bitwarden or Authenticator) +# - build_mode is one of: +# - Device: Build for physical iOS devices +# - Simulator: Build for iOS Simulator +# +# Examples: +# $ ./Scripts/build.sh project-pm.yml Bitwarden Simulator +# $ ./Scripts/build.sh project-bwa.yml Authenticator Device set -euo pipefail bold=$(tput -T ansi bold) normal=$(tput -T ansi sgr0) -if [ $# -lt 1 ]; then - echo >&2 "Called without necessary arguments: ${bold}mode${normal}" - echo >&2 "For example: \`Scripts/build.sh Simulator" +if [ $# -lt 3 ]; then + echo >&2 "Called without necessary arguments: ${bold}project_file build_scheme build_mode${normal}" + echo >&2 "For example: \`Scripts/build.sh project-pm.yml Bitwarden Simulator\`" exit 1 fi -MODE=$1 +PROJECT_FILE=$1 +BUILD_SCHEME=$2 +MODE=$3 BUILD_DIR="build" DERIVED_DATA_PATH="${BUILD_DIR}/DerivedData" -ARCHIVE_PATH="${BUILD_DIR}/Bitwarden.xcarchive" -EXPORT_PATH="${BUILD_DIR}/Bitwarden" +ARCHIVE_PATH="${BUILD_DIR}/${BUILD_SCHEME}.xcarchive" +EXPORT_PATH="${BUILD_DIR}/${BUILD_SCHEME}" echo "🧱 Building in ${bold}$(pwd)${normal}" -echo "🧱 Using build mode of ${bold}${MODE}${normal}." +echo "🧱 Project file ${bold}${PROJECT_FILE}${normal}" +echo "🧱 Build Scheme ${bold}${BUILD_SCHEME}${normal}" +echo "🧱 Using build mode of ${bold}${MODE}${normal}" echo "🧱 Derived Data path ${bold}${DERIVED_DATA_PATH}${normal}" echo "🧱 Archive path ${bold}${ARCHIVE_PATH}${normal}" echo "🧱 Export path ${bold}${EXPORT_PATH}${normal}" @@ -39,7 +50,7 @@ echo "" echo "🌱 Generating Xcode projects" mint run xcodegen --spec "project-bwk.yml" -mint run xcodegen --spec "project-pm.yml" +mint run xcodegen --spec "${PROJECT_FILE}" echo "" mkdir -p "${BUILD_DIR}" @@ -49,7 +60,7 @@ case "$MODE" in echo "🔨 Performing Xcode build" xcrun xcodebuild \ -workspace Bitwarden.xcworkspace \ - -scheme Bitwarden \ + -scheme "${BUILD_SCHEME}" \ -configuration Debug \ -destination "generic/platform=iOS Simulator" \ -derivedDataPath "${DERIVED_DATA_PATH}" \ @@ -59,7 +70,7 @@ case "$MODE" in echo "📦 Performing Xcode archive" xcrun xcodebuild archive \ -workspace Bitwarden.xcworkspace \ - -scheme Bitwarden \ + -scheme "${BUILD_SCHEME}" \ -configuration Release \ -archivePath "${ARCHIVE_PATH}" \ -derivedDataPath "${DERIVED_DATA_PATH}" \