Skip to content

Commit

Permalink
Split out build mode from build variant
Browse files Browse the repository at this point in the history
  • Loading branch information
KatherineInCode committed Nov 22, 2024
1 parent 9289566 commit 8768c8d
Showing 1 changed file with 27 additions and 16 deletions.
43 changes: 27 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ on:
- Beta
- Production
- Simulator
build-mode:
description: "Build Mode"
required: true
default: "Device"
type: choice
options:
- Device
- Simulator
build-version:
description: "Version Name Override - e.g. '2024.8.1'"
type: string
Expand Down Expand Up @@ -40,6 +48,9 @@ on:
build-variant:
description: "Build Variant"
type: string
build-mode:
description: "Build Mode"
type: string
build-version:
description: "Version Name Override - e.g. '2024.8.1'"
type: string
Expand Down Expand Up @@ -67,6 +78,7 @@ on:
type: boolean
env:
BUILD_VARIANT: ${{ inputs.build-variant || 'Beta' }}
BUILD_MODE: ${{ inputs.build-mode || 'Device' }}
XCODE_VERSION: ${{ inputs.xcode-version }}

jobs:
Expand Down Expand Up @@ -155,13 +167,13 @@ jobs:
${{ runner.os }}-mint-
- name: Log in to Azure
if: env.BUILD_VARIANT != 'Simulator'
if: env.BUILD_MODE != 'Simulator'
uses: Azure/login@cb79c773a3cfa27f31f25eb3f677781210c9ce3d # v1.6.1
with:
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}

- name: Retrieve secrets
if: env.BUILD_VARIANT != 'Simulator'
if: env.BUILD_MODE != 'Simulator'
uses: bitwarden/gh-actions/get-keyvault-secrets@main
with:
keyvault: "bitwarden-ci"
Expand Down Expand Up @@ -264,14 +276,14 @@ jobs:
plutil -replace BUNDLE_ID -string com.8bit.bitwarden.beta.watchkitapp BitwardenWatchApp/$TARGET_FILE
- name: Retrieve certificates
if: env.BUILD_VARIANT != 'Simulator'
if: env.BUILD_MODE != 'Simulator'
run: |
mkdir -p $HOME/certificates
az keyvault secret show --id https://bitwarden-ci.vault.azure.net/certificates/ios-distribution |
jq -r .value | base64 -d > $HOME/certificates/ios-distribution.p12
- name: Download Fastlane credentials
if: env.BUILD_VARIANT != 'Simulator'
if: env.BUILD_MODE != 'Simulator'
env:
ACCOUNT_NAME: bitwardenci
CONTAINER_NAME: mobile
Expand All @@ -282,7 +294,7 @@ jobs:
--file $HOME/secrets/$FILE --output none
- name: Configure Keychain Access
if: env.BUILD_VARIANT != 'Simulator'
if: env.BUILD_MODE != 'Simulator'
env:
KEYCHAIN_PASSWORD: ${{ secrets.IOS_KEYCHAIN_PASSWORD }}
run: |
Expand All @@ -296,7 +308,7 @@ jobs:
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $KEYCHAIN_PASSWORD build.keychain
- name: Configure provisioning profiles
if: env.BUILD_VARIANT != 'Simulator'
if: env.BUILD_MODE != 'Simulator'
run: |
./Scripts/configure_provisioning_profiles.sh ${{ env.BUILD_VARIANT }}
Expand All @@ -311,7 +323,7 @@ jobs:
echo 'app_identifier "com.8bit.bitwarden.beta"' > fastlane/Appfile
- name: Update APNS entitlements
if: env.BUILD_VARIANT != 'Simulator'
if: env.BUILD_MODE != 'Simulator'
run: |
plutil -replace aps-environment -string production Bitwarden/Application/Support/Bitwarden.entitlements
Expand All @@ -325,7 +337,7 @@ jobs:
brew update
- name: Install Fastlane
if: env.BUILD_VARIANT != 'Simulator'
if: env.BUILD_MODE != 'Simulator'
run: |
brew install fastlane
Expand All @@ -339,7 +351,6 @@ jobs:
mint bootstrap
- name: Select variant
if: env.BUILD_VARIANT != 'Simulator'
run: |
./Scripts/select_variant.sh ${{ env.BUILD_VARIANT }} "${{ inputs.compiler-flags }}"
Expand All @@ -354,49 +365,49 @@ jobs:
- name: Build iOS app
run: |
./Scripts/build.sh ${{ env.BUILD_VARIANT }}
./Scripts/build.sh ${{ env.BUILD_MODE }}
- name: Prepare APP files for upload to GitHub
if: env.BUILD_VARIANT == 'Simulator'
if: env.BUILD_MODE == 'Simulator'
run: |
find . -name "*.app"
mkdir -p export
cp -r build/DerivedData/Build/Products/Debug-iphonesimulator/Bitwarden.app export
cp -r build/DerivedData/Build/Products/Debug-watchsimulator/BitwardenWatchApp.app export
- name: Upload APP files
if: env.BUILD_VARIANT == 'Simulator'
if: env.BUILD_MODE == 'Simulator'
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: Bitwarden iOS ${{ steps.version_info.outputs.version_name }} (${{ steps.version_info.outputs.version_number }}) ${{ env.BUILD_VARIANT }} ${{ env.XCODE_VERSION || env.DEFAULT_XCODE_VERSION }}
path: export
if-no-files-found: error

- name: Prepare IPA & dSYM files for upload to GitHub
if: env.BUILD_VARIANT != 'Simulator'
if: env.BUILD_MODE != 'Simulator'
run: |
mkdir -p export/dSYMs
cp build/Bitwarden/Bitwarden.ipa export
cp -rv build/Bitwarden.xcarchive/dSYMs/*.dSYM export/dSYMs
- name: Upload IPA & dSYM files
if: env.BUILD_VARIANT != 'Simulator'
if: env.BUILD_MODE != 'Simulator'
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: Bitwarden iOS ${{ steps.version_info.outputs.version_name }} (${{ steps.version_info.outputs.version_number }}) ${{ env.BUILD_VARIANT }} ${{ env.XCODE_VERSION || env.DEFAULT_XCODE_VERSION }}
path: export
if-no-files-found: error

- name: Set up private auth key
if: env.BUILD_VARIANT != 'Simulator'
if: env.BUILD_MODE != 'Simulator'
run: |
mkdir ~/private_keys
cat << EOF > ~/private_keys/AuthKey_J46C83CB96.p8
${{ secrets.APP_STORE_CONNECT_AUTH_KEY }}
EOF
- name: Validate app with App Store Connect
if: env.BUILD_VARIANT != 'Simulator'
if: env.BUILD_MODE != 'Simulator'
run: |
xcrun altool --validate-app \
--type ios \
Expand Down

0 comments on commit 8768c8d

Please sign in to comment.