Skip to main content

Fastlane Plugin

Automate certificate management in your CI/CD pipeline

Installation

Terminal
$ gem install fastlane-plugin-appscert

Or 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'

Configuration

Set your API key as an environment variable or in your Fastfile:

Environment Variable
export APPSCERT_API_KEY="your_api_key_here"

Get your API key from Settings → Integrations.

Available Actions

appscert_sync

Sync certificates and profiles from Apple Developer Portal

lane :sync_certs do
  appscert_sync(
    bundle_id: "com.example.app",
    include_profiles: true
  )
end

appscert_download

Download certificates and profiles for code signing

lane :get_certs do
  appscert_download(
    bundle_id: "com.example.app",
    type: "distribution",
    output_path: "./certs"
  )
end

appscert_renew

Renew expiring provisioning profiles

lane :renew_profiles do
  appscert_renew(
    bundle_id: "com.example.app",
    days_before_expiry: 30
  )
end

appscert_status

Check 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
end

Complete Example

Fastfile
default_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

Parameters Reference

ParameterTypeDescription
api_keyStringAppsCert API key (or use APPSCERT_API_KEY env)
bundle_idStringApp bundle identifier
typeStringCertificate type: development, distribution
output_pathStringDirectory to save downloaded files
days_before_expiryIntegerRenew profiles expiring within N days (default: 30)
include_profilesBooleanInclude provisioning profiles in sync (default: true)

Resources