Skip to content

PlasmoHQ/safari-webstore-api

Repository files navigation

Safari Web Extension Publisher

This module uses Apple's safari-web-extension-converter to convert a Web Extension (i.e. Chrome Extension) to a Safari Web Extension, and uploads the native bundle to the Apple App Store using Fastlane. Deployment is available for both iOS and macOS platforms. Runs on both macOS and GitHub-hosted macOS runners. This is the Safari implementation for Plasmo Browser Platform Publisher.

Feature includes:

  • TypeScript API, with type exports
  • Pure ECMAScript module
  • Frozen dependencies, updated via renovatebot
  • Support for GitHub-hosted macOS runners

Limitations:

  • Only supports Manifest V2 extensions (for now)
  • This is beta software that may require handholding and knowledge of Xcode and Fastlane

Prerequisites (macOS Big Sur 11.3+)

  • Xcode (versions 13.2.1 or newer) xcode-select -s /Applications/Xcode_13.2.app
  • Xcode Command Line Tools xcode-select --install
  • Ruby (versions 2.5 or newer) brew install ruby
  • Bundler gem install bundler

Usage

  • Create cert storage with Fastlane Match (reference CodeSigning.guide) from any Mac; you won't need to set this up more than once
  • Create appIds (bundle identifiers) in App Store Connect manually or with Fastlane Produce
    • By default, extension bundle ids will be the same bundleId with .extension appended
    • Developers can optionally create their own extension bundle id and provide it with the extensionBundleId parameter
    • For Fastlane Produce, install Fastlane to your machine, run fastlane produce, and follow the prompts to create a new App through App Store Connect
  • Integrate into your GitHub Actions with Plasmo BPP

After App Store delivery

  • Create App Store page metadata
  • Manually submit the build for App Review

Options

App/Bundle Options

key required description
bundleId true i.e. com.plasmo.mock
extensionBundleId false i.e. com.plasmo.mock.extension
appName true i.e. Plasmo Mock
appCategory true last component of LSApplicationCategoryType (i.e. business)
platforms false defaults to iOS and macOS
buildNumber false defaults to GITHUB_RUN_NUMBER

Code Signing Identity

Read about Fastlane Appfile options

key description
appleId Your Apple email address
appleDevPortalId Apple Developer Account email address
teamName i.e. Plasmo Corp.
teamId i.e. Q2CBPJ58CA
itunesConnectId App Store Connect Account email address
itcTeamName i.e. "Company Name" for Apple IDs in multiple teams
itcTeamId i.e. "18742801" for Apple IDs in multiple teams

Code Signing Options

If you want to use custom provisioning profiles that weren't generated in the pattern of Fastlane Match provisioning profiles

key required description
provisioningProfiles false array of ProvisioningProfiles

App Store Connect API Key

Read about the App Store Connect API

key required description
keyId true i.e. "D383SF739"
key true i.e. "-----BEGIN PRIVATE KEY-----\nMIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHknlhdlYdLu\n-----END PRIVATE KEY-----"
issuerId true i.e. "6053b7fe-68a8-4acb-89be-165aa6465141"
duration false optional (maximum 1200)

Fastlane Match Options

Read about Fastlane Match options

key description
matchPassword shared storage encryption password
matchStorageMode defaults to git
matchGitUrl for git
matchGitBranch for git
matchGitBasicAuthorization for git
matchGitBearerAuthorization for git
matchGitPrivateKey for git
matchGoogleCloudBucketName for Google Cloud
matchGoogleCloudKeysFile for Google Cloud
matchGoogleCloudProjectId for Google Cloud
matchS3Region for S3
matchS3AccessKey for S3
matchS3SecretAccessKey for S3
matchS3Bucket for S3

Debugging Options

key description
workspace non-tmp static directory to generate workspace to (for file system debugging or project exports)
verbose toggle more detailed logs

GitHub Action Workflow

jobs:
  test:
    runs-on: macos-10.15
    timeout-minutes: 15
    steps:
      - name: Git - Checkout
        uses: actions/checkout@v3.0.0
        with:
          ref: ${{ github.ref }}
      - name: Setup - Xcode
        run: xcode-select -s /Applications/Xcode_13.2.app
      - name: Setup - Ruby and bundler dependencies
        uses: ruby/setup-ruby@v1.99.0
        with:
          bundler-cache: true
      - name: Safari Webstore Upload via Browser Platform Publish
        uses: PlasmoHQ/bpp@v2
        with:
          keys: ${{ secrets.BPP_KEYS }}

Node.js API

import { SafariPublisher } from "@PlasmoHQ/safari-publisher"

const client = new SafariPublisher({
  "bundleId": "com.plasmo.mock",
  "appName": "Plasmo Mock",
  "appCategory": "developer-tools",
  "platforms": ["ios", "macos"],
  "appleId": "DEVELOPER_APPLE_ID",
  "teamId": "APPLE_DEVELOPER_TEAM_ID",
  "teamName": "Plasmo Corp.",
  "keyId": "APP_STORE_CONNECT_API_KEY_ID",
  "issuerId": "APP_STORE_CONNECT_API_ISSUER_ID",
  "key": "APP_STORE_CONNECT_API_KEY",
  "matchPassword": "YOUR_MATCH_ENCRYPTION_PASSWORD",
  "matchGitUrl": "YOUR_MATCH_REPO"
})


await client.submit({
  filePath: zip
})

Future

Adopt XcodeGen to simplify project generation and schema management

We currently manually modify the generated Xcode project to suit our needs, which may be difficult to maintain:

Acknowledgment

License

MITPlasmo Corp.

About

No description, website, or topics provided.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •