Automate certificate management in your CI/CD pipeline
$ gem install fastlane-plugin-appscertOr download the plugin directly and install from source:
# Unzip and add to your Fastfile:
fastlane_require 'fastlane-plugin-appscert'Or add to your Gemfile:
gem 'fastlane-plugin-appscert'Set your API key as an environment variable or in your Fastfile:
export APPSCERT_API_KEY="your_api_key_here"Get your API key from Settings → Integrations.
Sync certificates and profiles from Apple Developer Portal
lane :sync_certs do
appscert_sync(
bundle_id: "com.example.app",
include_profiles: true
)
endDownload certificates and profiles for code signing
lane :get_certs do
appscert_download(
bundle_id: "com.example.app",
type: "distribution",
output_path: "./certs"
)
endRenew expiring provisioning profiles
lane :renew_profiles do
appscert_renew(
bundle_id: "com.example.app",
days_before_expiry: 30
)
endCheck certificate and profile expiration status
lane :check_status do
status = appscert_status(
bundle_id: "com.example.app"
)
if status[:expiring].any?
UI.important("⚠️ Some items are expiring soon!")
end
enddefault_platform(:ios)
platform :ios do
desc "Build and sign the app"
lane :build do
# Sync latest from Apple Developer Portal
appscert_sync(bundle_id: ENV["BUNDLE_ID"])
# Auto-renew if needed
appscert_renew(
bundle_id: ENV["BUNDLE_ID"],
days_before_expiry: 14
)
# Download signing credentials
appscert_download(
bundle_id: ENV["BUNDLE_ID"],
type: "distribution",
output_path: "./signing"
)
# Install certificates
import_certificate(
certificate_path: "./signing/certificate.p12",
keychain_name: "fastlane_tmp_keychain"
)
# Install profile
install_provisioning_profile(
path: "./signing/profile.mobileprovision"
)
# Build
gym(
scheme: ENV["SCHEME"],
export_method: "app-store"
)
end
desc "Daily certificate check"
lane :check do
status = appscert_status
if status[:expired].any?
slack(
message: "🚨 Expired certificates detected!",
slack_url: ENV["SLACK_WEBHOOK"]
)
elsif status[:expiring_7d].any?
slack(
message: "⚠️ Certificates expiring in 7 days",
slack_url: ENV["SLACK_WEBHOOK"]
)
end
end
end| Parameter | Type | Description |
|---|---|---|
| api_key | String | AppsCert API key (or use APPSCERT_API_KEY env) |
| bundle_id | String | App bundle identifier |
| type | String | Certificate type: development, distribution |
| output_path | String | Directory to save downloaded files |
| days_before_expiry | Integer | Renew profiles expiring within N days (default: 30) |
| include_profiles | Boolean | Include provisioning profiles in sync (default: true) |