Fastlane Plugin
Integrate Shield iOS directly into your Fastlane pipeline. Protect your app as part of your CI/CD lanes.
Prerequisites
Install the shield-ios CLI on the machine that runs Fastlane:
pip install bytehide-shield-ios
# or
brew install bytehide/tap/shield-iospip install bytehide-shield-ios
# or
brew install bytehide/tap/shield-iosInstall the Plugin
fastlane add_plugin shield_iosfastlane add_plugin shield_iosOr add it manually to your Pluginfile:
gem "fastlane-plugin-shield_ios"gem "fastlane-plugin-shield_ios"Then run:
bundle installbundle installUsage
Basic Example
platform :ios do
lane :release do
build_app(
scheme: "MyApp",
archive_path: "build/MyApp.xcarchive",
skip_package_ipa: true
)
shield_ios(
archive_path: "build/MyApp.xcarchive",
config: "shield-ios.json"
)
build_app(
archive_path: "build/MyApp.xcarchive",
skip_build_archive: true
)
upload_to_app_store
end
endplatform :ios do
lane :release do
build_app(
scheme: "MyApp",
archive_path: "build/MyApp.xcarchive",
skip_package_ipa: true
)
shield_ios(
archive_path: "build/MyApp.xcarchive",
config: "shield-ios.json"
)
build_app(
archive_path: "build/MyApp.xcarchive",
skip_build_archive: true
)
upload_to_app_store
end
endThe flow is:
build_app— Compiles and creates the.xcarchive(skip IPA packaging)shield_ios— Applies protections to the archivebuild_app— Packages the protected archive into an IPA (Xcode handles signing)upload_to_app_store— Uploads to App Store Connect
Protect an IPA Directly
shield_ios(
archive_path: "build/MyApp.ipa",
config: "shield-ios.json"
)shield_ios(
archive_path: "build/MyApp.ipa",
config: "shield-ios.json"
)Custom Output Path
shield_ios(
archive_path: "build/MyApp.xcarchive",
output_path: "build/MyApp-protected.xcarchive",
config: "shield-ios.json",
no_sign: false,
verbose: true
)shield_ios(
archive_path: "build/MyApp.xcarchive",
output_path: "build/MyApp-protected.xcarchive",
config: "shield-ios.json",
no_sign: false,
verbose: true
)Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
archive_path | String | Yes | — | Path to the .xcarchive or .ipa |
output_path | String | No | Same as input | Output path for the protected archive |
config | String | No | nil | Path to shield-ios.json configuration file |
no_sign | Boolean | No | true | Skip code signing after protection |
verbose | Boolean | No | false | Enable verbose output |
Environment Variables
All parameters can be set via environment variables, useful for CI/CD:
| Variable | Parameter |
|---|---|
SHIELD_IOS_ARCHIVE_PATH | archive_path |
SHIELD_IOS_OUTPUT_PATH | output_path |
SHIELD_IOS_CONFIG | config |
SHIELD_IOS_NO_SIGN | no_sign |
SHIELD_IOS_VERBOSE | verbose |
Example with env vars:
export SHIELD_IOS_ARCHIVE_PATH="build/MyApp.xcarchive"
export SHIELD_IOS_CONFIG="shield-ios.json"export SHIELD_IOS_ARCHIVE_PATH="build/MyApp.xcarchive"
export SHIELD_IOS_CONFIG="shield-ios.json"# Fastfile — no arguments needed
shield_ios# Fastfile — no arguments needed
shield_iosCI/CD Examples
GitHub Actions
- name: Install Shield iOS
run: pip install bytehide-shield-ios
- name: Build and Protect
run: |
bundle exec fastlane release- name: Install Shield iOS
run: pip install bytehide-shield-ios
- name: Build and Protect
run: |
bundle exec fastlane releaseGitLab CI
release:
stage: deploy
script:
- pip install bytehide-shield-ios
- bundle exec fastlane releaserelease:
stage: deploy
script:
- pip install bytehide-shield-ios
- bundle exec fastlane releaseJenkins
stage('Release') {
steps {
sh 'pip install bytehide-shield-ios'
sh 'bundle exec fastlane release'
}
}stage('Release') {
steps {
sh 'pip install bytehide-shield-ios'
sh 'bundle exec fastlane release'
}
}Troubleshooting
"shield-ios CLI not found"
The plugin requires the shield-ios CLI to be installed on the system. Install it with:
pip install bytehide-shield-iospip install bytehide-shield-iosMake sure it's in the PATH of the user running Fastlane.
"archive_path must be an .xcarchive or .ipa file"
The archive_path must point to a file with .xcarchive or .ipa extension.
"Archive not found at path"
The file doesn't exist at the specified path. Make sure build_app ran successfully and the path matches.
Next Steps
CLI Reference
Full CLI reference and protection options
Xcode Integration
Manual Xcode setup with post-archive actions
CI/CD Integration
GitHub Actions, GitLab CI, and more