Skip to content

Commit

Permalink
[PM-11313] [BEEEP] Improve provisioning profiles configuration in the…
Browse files Browse the repository at this point in the history
… CI/CD workflow (#868)
  • Loading branch information
fedemkr authored Aug 27, 2024
1 parent 8d48de0 commit de15fe4
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 68 deletions.
70 changes: 2 additions & 68 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -267,75 +267,9 @@ jobs:
-T /usr/bin/security
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $KEYCHAIN_PASSWORD build.keychain
- name: Configure production provisioning profiles
if: env.BUILD_VARIANT == 'Production'
run: |
AUTOFILL_PROFILE_PATH=$HOME/secrets/dist_autofill.mobileprovision
BITWARDEN_PROFILE_PATH=$HOME/secrets/dist_bitwarden.mobileprovision
EXTENSION_PROFILE_PATH=$HOME/secrets/dist_extension.mobileprovision
SHARE_EXTENSION_PROFILE_PATH=$HOME/secrets/dist_share_extension.mobileprovision
WATCH_APP_PROFILE_PATH=$HOME/secrets/dist_bitwarden_watch_app.mobileprovision
WATCH_APP_EXTENSION_PROFILE_PATH=$HOME/secrets/dist_bitwarden_watch_app_extension.mobileprovision
WATCH_WIDGET_EXTENSION_PROFILE_PATH=$HOME/secrets/dist_bitwarden_watch_widget_extension.mobileprovision
PROFILES_DIR_PATH=$HOME/Library/MobileDevice/Provisioning\ Profiles
mkdir -p "$PROFILES_DIR_PATH"
AUTOFILL_UUID=$(grep UUID -A1 -a $AUTOFILL_PROFILE_PATH | grep -io "[-A-F0-9]\{36\}")
cp $AUTOFILL_PROFILE_PATH "$PROFILES_DIR_PATH/$AUTOFILL_UUID.mobileprovision"
BITWARDEN_UUID=$(grep UUID -A1 -a $BITWARDEN_PROFILE_PATH | grep -io "[-A-F0-9]\{36\}")
cp $BITWARDEN_PROFILE_PATH "$PROFILES_DIR_PATH/$BITWARDEN_UUID.mobileprovision"
EXTENSION_UUID=$(grep UUID -A1 -a $EXTENSION_PROFILE_PATH | grep -io "[-A-F0-9]\{36\}")
cp $EXTENSION_PROFILE_PATH "$PROFILES_DIR_PATH/$EXTENSION_UUID.mobileprovision"
SHARE_EXTENSION_UUID=$(grep UUID -A1 -a $SHARE_EXTENSION_PROFILE_PATH | grep -io "[-A-F0-9]\{36\}")
cp $SHARE_EXTENSION_PROFILE_PATH "$PROFILES_DIR_PATH/$SHARE_EXTENSION_UUID.mobileprovision"
WATCH_APP_UUID=$(grep UUID -A1 -a $WATCH_APP_PROFILE_PATH | grep -io "[-A-F0-9]\{36\}")
cp $WATCH_APP_PROFILE_PATH "$PROFILES_DIR_PATH/$WATCH_APP_UUID.mobileprovision"
WATCH_APP_EXTENSION_UUID=$(grep UUID -A1 -a $WATCH_APP_EXTENSION_PROFILE_PATH | grep -io "[-A-F0-9]\{36\}")
cp $WATCH_APP_EXTENSION_PROFILE_PATH "$PROFILES_DIR_PATH/$WATCH_APP_EXTENSION_UUID.mobileprovision"
WATCH_WIDGET_EXTENSION_UUID=$(grep UUID -A1 -a $WATCH_WIDGET_EXTENSION_PROFILE_PATH | grep -io "[-A-F0-9]\{36\}")
cp $WATCH_WIDGET_EXTENSION_PROFILE_PATH "$PROFILES_DIR_PATH/$WATCH_WIDGET_EXTENSION_UUID.mobileprovision"
- name: Configure beta provisioning profiles
if: env.BUILD_VARIANT == 'Beta'
- name: Configure provisioning profiles
run: |
AUTOFILL_PROFILE_PATH=$HOME/secrets/dist_beta_autofill.mobileprovision
BITWARDEN_PROFILE_PATH=$HOME/secrets/dist_beta_bitwarden.mobileprovision
EXTENSION_PROFILE_PATH=$HOME/secrets/dist_beta_extension.mobileprovision
SHARE_EXTENSION_PROFILE_PATH=$HOME/secrets/dist_beta_share_extension.mobileprovision
WATCH_APP_PROFILE_PATH=$HOME/secrets/dist_beta_bitwarden_watch_app.mobileprovision
WATCH_APP_EXTENSION_PROFILE_PATH=$HOME/secrets/dist_beta_bitwarden_watch_app_extension.mobileprovision
WATCH_WIDGET_EXTENSION_PROFILE_PATH=$HOME/secrets/dist_beta_bitwarden_watch_widget_extension.mobileprovision
PROFILES_DIR_PATH=$HOME/Library/MobileDevice/Provisioning\ Profiles
mkdir -p "$PROFILES_DIR_PATH"
AUTOFILL_UUID=$(grep UUID -A1 -a $AUTOFILL_PROFILE_PATH | grep -io "[-A-F0-9]\{36\}")
cp $AUTOFILL_PROFILE_PATH "$PROFILES_DIR_PATH/$AUTOFILL_UUID.mobileprovision"
BITWARDEN_UUID=$(grep UUID -A1 -a $BITWARDEN_PROFILE_PATH | grep -io "[-A-F0-9]\{36\}")
cp $BITWARDEN_PROFILE_PATH "$PROFILES_DIR_PATH/$BITWARDEN_UUID.mobileprovision"
EXTENSION_UUID=$(grep UUID -A1 -a $EXTENSION_PROFILE_PATH | grep -io "[-A-F0-9]\{36\}")
cp $EXTENSION_PROFILE_PATH "$PROFILES_DIR_PATH/$EXTENSION_UUID.mobileprovision"
SHARE_EXTENSION_UUID=$(grep UUID -A1 -a $SHARE_EXTENSION_PROFILE_PATH | grep -io "[-A-F0-9]\{36\}")
cp $SHARE_EXTENSION_PROFILE_PATH "$PROFILES_DIR_PATH/$SHARE_EXTENSION_UUID.mobileprovision"
WATCH_APP_UUID=$(grep UUID -A1 -a $WATCH_APP_PROFILE_PATH | grep -io "[-A-F0-9]\{36\}")
cp $WATCH_APP_PROFILE_PATH "$PROFILES_DIR_PATH/$WATCH_APP_UUID.mobileprovision"
WATCH_APP_EXTENSION_UUID=$(grep UUID -A1 -a $WATCH_APP_EXTENSION_PROFILE_PATH | grep -io "[-A-F0-9]\{36\}")
cp $WATCH_APP_EXTENSION_PROFILE_PATH "$PROFILES_DIR_PATH/$WATCH_APP_EXTENSION_UUID.mobileprovision"
WATCH_WIDGET_EXTENSION_UUID=$(grep UUID -A1 -a $WATCH_WIDGET_EXTENSION_PROFILE_PATH | grep -io "[-A-F0-9]\{36\}")
cp $WATCH_WIDGET_EXTENSION_PROFILE_PATH "$PROFILES_DIR_PATH/$WATCH_WIDGET_EXTENSION_UUID.mobileprovision"
./Scripts/configure_provisioning_profiles.sh ${{ env.BUILD_VARIANT }}
- name: Update beta export compliance key
if: env.BUILD_VARIANT == 'Beta'
Expand Down
52 changes: 52 additions & 0 deletions Scripts/configure_provisioning_profiles.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env bash
#
# Configures the provisioning profiles for a given variant.
#
# Usage:
#
# $ ./configure_provisioning_profiles.sh <variant>

set -euo pipefail

bold=$(tput -T ansi bold)
normal=$(tput -T ansi sgr0)

if [ $# -ne 1 ]; then
echo >&2 "Called without necessary arguments: ${bold}Variant${normal}."
echo >&2 "For example: \`Scripts/configure_provisioning_profiles.sh Beta"
exit 1
fi

variant=$1

echo "🧱 Configure provisioning profiles on ${bold}${variant}${normal}."

case $variant in
Production)
profile_prefix="dist_"
;;
Beta)
profile_prefix="dist_beta_"
;;
esac

profiles_dir_path=$HOME/Library/MobileDevice/Provisioning\ Profiles

mkdir -p "$profiles_dir_path"

profiles=(
"autofill"
"bitwarden"
"extension"
"share_extension"
"bitwarden_watch_app"
"bitwarden_watch_app_extension"
"bitwarden_watch_widget_extension"
)

for file in "${profiles[@]}"
do
profile_path=$HOME/secrets/$profile_prefix$file.mobileprovision
profile_uuid=$(grep UUID -A1 -a $profile_path | grep -io "[-A-F0-9]\{36\}")
cp $profile_path "$profiles_dir_path/$profile_uuid.mobileprovision"
done

0 comments on commit de15fe4

Please sign in to comment.