Electron-builder: Add a configuration option to specify the location of a provisioning profile

Created on 7 Oct 2017  路  12Comments  路  Source: electron-userland/electron-builder

Following on from #2142:

When building for the mas-dev target, by default, a provisioning profile in the working directory is automatically used for code signing by electron-osx-sign. It would be good to be able to pass a CLI arg or set a config file parameter to specify a location for the file and pass it on with e.g.

electron-osx-sign path/to/my.app --provisioning-profile=path/to/my.provisionprofile

or using the provisioning-profile option in calls to require('electron-osx-sign').sign/signAsync

feature mac

Most helpful comment

Is anyone working on this? Would it be possible to specify a provisioning profile in the settings?

Something like this:

"build": {
    "appId": "com.copany.someapp",
    "productName": "someapp",
    "buildVersion": "1.0.11",
    "mac": {
      "target": [
        "mas-dev"
      ],
      "category": "public.app-category.games",
      "icon": "src/electron/assets/store.icns",
      "entitlements": "src/electron/entitlements.mac.plist",
      "type": "development"
    },
    "mas-dev": {
      "category": "public.app-category.games",
      "entitlements": "src/electron/entitlements.mas.plist",
      "type": "distribution",
      "provisioning-profile": "src/electron/mas-dev.provisioningProfile"
    },
    "files": [
      "src/electron.js",
      "src/electron/**/*",
      "package.json"
    ],
  },

All 12 comments

Is anyone working on this? Would it be possible to specify a provisioning profile in the settings?

Something like this:

"build": {
    "appId": "com.copany.someapp",
    "productName": "someapp",
    "buildVersion": "1.0.11",
    "mac": {
      "target": [
        "mas-dev"
      ],
      "category": "public.app-category.games",
      "icon": "src/electron/assets/store.icns",
      "entitlements": "src/electron/entitlements.mac.plist",
      "type": "development"
    },
    "mas-dev": {
      "category": "public.app-category.games",
      "entitlements": "src/electron/entitlements.mas.plist",
      "type": "distribution",
      "provisioning-profile": "src/electron/mas-dev.provisioningProfile"
    },
    "files": [
      "src/electron.js",
      "src/electron/**/*",
      "package.json"
    ],
  },

I've sent a PR for this feature, please test

provisioningProfile field can be assigned for dmg, mas and mas-dev target options.

Suggestion: perhaps you should add a specific "electron-osx-sign" options section that gets sent verbatim to electron-osx-sign. This might not be necessary, but rather than trying to hide electron-osx-sign, it's complicated enough, and has extensive enough documentation, that enabling it's detailed control from within electron-builder seems like a good idea to me.

That said, this specific fix works for my current particular need.

Also, sorry but I can't PR it. e-builder is pretty complex.

As I understand this is needed not only for mas for but for mac builds that are signed as well.

I'm currently using a bit of code in afterPack that copies the correct provisionprofile according to mac/mas.

@mcfedr Can you share that piece of code?

Something like this..

let profile = {
    'mas': 'signing/mac_dist.provisionprofile',
    'darwin': 'signing/dev_id_dist.provisionprofile',
  }

  electronBuilder.build({
    ...,
    afterPack: ({ appOutDir, packager, electronPlatformName }) => {
          console.log('appOutDir', appOutDir, electronPlatformName)
          return Promise.resolve()
            .then(() => {
              if (packager.platform.name !== 'mac') {
                return
              }
              return new Promise((resolve, reject) => {
                if (!profile[electronPlatformName]) {
                  reject(new Error(`Missing profile path for ${electronPlatformName}`))
                }
                cpr(profile[electronPlatformName],
                  `${appOutDir}/MY-APP.app/Contents/embedded.provisionprofile`,
                  (err) => {
                    if (err) return reject(err)
                    resolve()
                  })
              })
              // })
            })
        }
    })

Fixed 2 days after I have this issue, great turn around! 馃憤

Nice one, can the docs be updated? https://www.electron.build/configuration/mac

Afair, should just be a case of running yarn docs and committing.

@jwheare I'll try to do it today.

@jwheare well, not so easy: I have a JSDoc error on the builder-util-runtime module property; somehow, module references with local paths cannot be parsed, it seems. Anyway you can take a look?

Ah, I had issues with generating docs too in the reffed issue this follows on from: https://github.com/electron-userland/electron-builder/pull/2142#issuecomment-333366594

Note: I made the changes to the autogenerated block in mac.md manually cos I couldn't get yarn docs to work.

But that issue was apparently fixed. Maybe just make the changes manually like in that issue.

Only me can fix doc generator, I hope this week.

Was this page helpful?
0 / 5 - 0 ratings