Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple publish targets does not work after version 22.9.1 #8993

Open
qtphan734 opened this issue Mar 27, 2025 · 2 comments
Open

Multiple publish targets does not work after version 22.9.1 #8993

qtphan734 opened this issue Mar 27, 2025 · 2 comments

Comments

@qtphan734
Copy link

I have the following in my electron-build.json project.

	"publish": [
		{
			"provider": "github",
			"private": true,
			"owner": "company1",
			"repo": "repo1"
		},
		{
			"provider": "github",
			"private": false,
			"owner": "company1",
			"repo": "repo2"
		}
	],

After upgrading electron builder from version 22.9.1, I get the following error:

ValidationError: Invalid configuration object. electron-builder 22.14.13 has been initialized using a configuration object that does not match the API schema.
 - configuration.publish should be one of these:
   object { provider, channel?, host?, owner?, private?, protocol?, publishAutoUpdate?, publisherName?, releaseType?, repo?, requestHeaders?, token?, updaterCacheDirName?, vPrefixedTagName? } | object { bucket, provider, acl?, channel?, encryption?, endpoint?, path?, publishAutoUpdate?, publisherName?, region?, requestHeaders?, storageClass?, updaterCacheDirName? } | object { name, provider, region, acl?, channel?, path?, publishAutoUpdate?, publisherName?, requestHeaders?, updaterCacheDirName? } | object { provider, url, channel?, publishAutoUpdate?, publisherName?, requestHeaders?, updaterCacheDirName?, useMultipleRangeRequest? } | object { provider, component?, distribution?, owner?, package?, publishAutoUpdate?, publisherName?, repo?, requestHeaders?, token?, updaterCacheDirName?, user? } | object { provider, publishAutoUpdate?, publisherName?, requestHeaders?, updateProvider?, updaterCacheDirName?, <key>: {} } | object { account, product, provider, channel?, platform?, publishAutoUpdate?, publisherName?, requestHeaders?, updaterCacheDirName? } | object { provider, channels?, publishAutoUpdate?, publisherName?, repo?, requestHeaders?, updaterCacheDirName? } | object { owner, provider, slug, channel?, publishAutoUpdate?, publisherName?, requestHeaders?, token?, updaterCacheDirName?, username? } | [object { provider, channel?, host?, owner?, private?, protocol?, publishAutoUpdate?, publisherName?, releaseType?, repo?, requestHeaders?, token?, updaterCacheDirName?, vPrefixedTagName? } | object { bucket, provider, acl?, channel?, encryption?, endpoint?, path?, publishAutoUpdate?, publisherName?, region?, requestHeaders?, storageClass?, updaterCacheDirName? } | object { name, provider, region, acl?, channel?, path?, publishAutoUpdate?, publisherName?, requestHeaders?, updaterCacheDirName? } | object { provider, url, channel?, publishAutoUpdate?, publisherName?, requestHeaders?, updaterCacheDirName?, useMultipleRangeRequest? } | object { provider, component?, distribution?, owner?, package?, publishAutoUpdate?, publisherName?, repo?, requestHeaders?, token?, updaterCacheDirName?, user? } | object { provider, publishAutoUpdate?, publisherName?, requestHeaders?, updateProvider?, updaterCacheDirName?, <key>: {} } | object { account, product, provider, channel?, platform?, publishAutoUpdate?, publisherName?, requestHeaders?, updaterCacheDirName? } | object { provider, channels?, publishAutoUpdate?, publisherName?, repo?, requestHeaders?, updaterCacheDirName? } | object { owner, provider, slug, channel?, publishAutoUpdate?, publisherName?, requestHeaders?, token?, updaterCacheDirName?, username? } | string, ...] | null | string
   Details:
    * configuration.publish[0].provider should be "s3".
      -> The provider. Must be `s3`.
    * configuration.publish[0].provider should be "spaces".
      -> The provider. Must be `spaces`.
    * configuration.publish[0].provider should be "generic".
      -> The provider. Must be `generic`.
    * configuration.publish[0].provider should be "bintray".
      -> The provider. Must be `bintray`.
    * configuration.publish[0].provider should be "custom".
      -> The provider. Must be `custom`.
    * configuration.publish[0].provider should be "keygen".
      -> The provider. Must be `keygen`.
    * configuration.publish[0].provider should be "snapStore".
      -> The provider. Must be `snapStore`.
    * configuration.publish[0].provider should be "bitbucket".
      -> The provider. Must be `bitbucket`.
     How to fix:
     1. Open https://www.electron.build/configuration/configuration
     2. Search the option name on the page (or type in into Search to find across the docs).
       * Not found? The option was deprecated or not exists (check spelling).
       * Found? Check that the option in the appropriate place. e.g. "title" only in the "dmg", not in the root.

Upon troubleshooting, it appears that the data being passed into the validator's validate() is incorrect

publish: [
    {
      '0': {
        provider: 'github',
        private: true,
        owner: 'company1',
        repo: 'repo1'
      },
      '1': {
        provider: 'github',
        private: false,
        owner: 'company1',
        repo: 'repo2
      },
      provider: 'github',
      private: true,
      owner: 'company1',
      repo: 'repo1'
    },
    {
      provider: 'github',
      private: false,
      owner: company1',
      repo: 'repo2'
    }
  ],
@qtphan734
Copy link
Author

I have figured out what is causing the issue. In my project, I wrote a script to run electron builder, so I can dynamically adjust the configuration within the electron-builder.json.

const builder = require("electron-builder");
let config = {};
const builderConfig = JSON.parse(fs.readFileSync("electron-builder-something-else.json"))
// Adjust config object below
//.....
config.config = builderConfig;
builder.build(config);

I can see from the logs that electron-builder initially loads electron-builder.json config first and then loads executes my function. If I rename the config file to something else other than electron-builder.json, it works just fine

@mmaietta
Copy link
Collaborator

This makes sense I think since you're using a custom script. electron-builder.json is a reserved config filename that is automatically loaded to handle workspace-style projects. Is there any reason to not have your config file named something else? This doesn't sound like a bug to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants