Skip to content

How to only publish? #4535

@cawa-93

Description

@cawa-93
Contributor
  • Target: any

In my workflow, I have to build an application, then test it, and ONLY then publish it.
To build an application without publishing, I use the command

electron-builder -p never

But how can I only publish? I already have an builded application and want to publish it. How can I do this. Is there any custom parameter to skip compilation and just publish the assembly. Something like this:

electron-builder --prebuilded <build dir> -p always

Activity

changed the title [-]How to only publish[/-] [+]How to only publish?[/+] on Dec 15, 2019
stale

stale commented on Feb 13, 2020

@stale

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

hgouveia

hgouveia commented on Apr 2, 2020

@hgouveia

i am also interested in this functionality , i already has the installer using --publish never but now in later stage i want to publish it to S3, but without rebuilding it, i would like something --distrib ./build/myinstaller.exe --c.publish.channel=channel

as a workaround i did my custom publisher, that i can trigger separatly and specify a file,
in case is useful : https://gist.github.com/hgouveia/91727cade15fb931993eedc41efa9a62

cawa-93

cawa-93 commented on Jun 15, 2020

@cawa-93
ContributorAuthor

@develar Is there a chance that this issue will be considered?

MutableLoss

MutableLoss commented on Nov 13, 2020

@MutableLoss

The project I manage would really benefit from such a feature, as I also use a local build routine (build -> test -> publish), uploading to GitHub.

I build to 4 different targets, so I lose a significant amount of time with each app release because of the extra time taken to build during publishing. While I am planning to switch to a TravisCI setup (for this exact reason), I can still see where this feature could save a lot of time in the build process for myself and many others.

Is there a particular concern with adding a 'publish existing build'? Maybe a concern specific to electron-publish?

cinan

cinan commented on Feb 5, 2021

@cinan

this issue should be reopened

MutableLoss

MutableLoss commented on Feb 8, 2021

@MutableLoss

Can any of the maintainers add their thoughts on this addition? At the very least, can someone explain why this hasn't received any attention in the past?

I'm willing to dig into this myself, but I'll be honest, I don't want to waste my time if there are legitimate concerns.

mspoerer

mspoerer commented on Mar 11, 2021

@mspoerer

+1

RobertLowe

RobertLowe commented on Jul 3, 2021

@RobertLowe

This would be a good workflow add. I typically want to review my build after building, but might not be ready to publish it, if I decide I am, I don't want to necessarily wait for the build time again.

fgu-neo-soft

fgu-neo-soft commented on Jul 8, 2021

@fgu-neo-soft

Really a must have for my project too !
Please reopen 👍

mmaietta

mmaietta commented on Jul 9, 2021

@mmaietta
Collaborator

I thought that was what --prepackaged configuration was supposed to provide.
Or are you requesting a way to do it after all processes, just using electron-publish?

Can any of the maintainers add their thoughts on this addition? At the very least, can someone explain why this hasn't received any attention in the past?

I'm willing to dig into this myself, but I'll be honest, I don't want to waste my time if there are legitimate concerns.

My best guess is that only develar was maintaining the project at the time and didn't have time to get to this feature request.

I have no concerns from my side.

MutableLoss

MutableLoss commented on Jul 27, 2021

@MutableLoss

Thanks @mmaietta !

Exactly to the latter. At the moment there isn't an optimal way to test builds in a publish workflow without having to publish multiple times, or build multiple times. One idea was to reuse the build used for testing with the publish, and remove an additional build process.

3 remaining items

MutableLoss

MutableLoss commented on Dec 7, 2022

@MutableLoss

So if this isn't resolved, why has it been closed? Is it a feature that's not feasible?

mmaietta

mmaietta commented on Dec 8, 2022

@mmaietta
Collaborator

It's not feasible with the current logic flow.

Happy to accept a community contribution if someone else is willing to investigate. Looks like a good start would be extracting much of the Provider logic to the packages/electron-publish subrepo to externalize an API for this "only publish" functionality.

MutableLoss

MutableLoss commented on Dec 11, 2022

@MutableLoss

@mmaietta Ok great, and absolutely! Thanks for the clarification, I definitely wanted to make sure this was something feasibly inline with the project before doing anything else. I'll try to carve out some time for this soon. Cheers 🙌

pelletier197

pelletier197 commented on Mar 20, 2024

@pelletier197

I figure this wasn't added since 2022 ? I have the same requirement, because I have a previous step in my pipeline that signs the executables produced by electron. I absolutely have to upload those executables when publishing, I cannot build them again.

I don't mind doing the manual publish to keygen, but why this is closed if this is such a common use-case?

mmaietta

mmaietta commented on Mar 20, 2024

@mmaietta
Collaborator

I'll see if I can take a stab at this when I find some free time

mmaietta

mmaietta commented on Mar 24, 2024

@mmaietta
Collaborator

Created a draft PR #8150 with the following functionality. Still testing locally and trying to get some automated tests set up

Proposed solution

  • electron-builder publish -f <filepath> -f <filepath2>
    • It should allow you to configure publish directly via electron-builder.js config. Note, it only can access the global publish config, not any nested ones within a specific arch/target since the files provided don't have an associated arch/target.
  • Two APIs are available for the JS-approach script file. The latter allows an explicit array of PublishConfiguration for a more fine-grain approach when using
const electronBuilder. = require('electron-builder')

electronBuilder.publish(args: { files: string[] }
// OR
electronBuilder.publishArtifactsWithOptions(uploadOptions: { file: string; arch: string | null }[], publishConfiguration?: PublishConfiguration[])

These internally create UploadTasks.

export interface UploadTask {
file: string
fileContent?: Buffer | null
arch: Arch | null
safeArtifactName?: string | null
timeout?: number | null
}

safeArtifactName is calculated internally since it seems Github requires some funky logic.
export function computeSafeArtifactNameIfNeeded(suggestedName: string | null, safeNameProducer: () => string): string | null {
// GitHub only allows the listed characters in file names.
if (suggestedName != null) {
if (isSafeGithubName(suggestedName)) {
return null
}
// prefer to use suggested name - so, if space is the only problem, just replace only space to dash
suggestedName = suggestedName.replace(/ /g, "-")
if (isSafeGithubName(suggestedName)) {
return suggestedName
}
}
return safeNameProducer()
}

Please provide your thoughts and I'll try to incorporate them. Will likely need volunteers to test this feature in their project configurations as well

pelletier197

pelletier197 commented on Mar 24, 2024

@pelletier197

Sounds awesome. Thanks a lot for this!

mmaietta

mmaietta commented on Apr 3, 2024

@mmaietta
Collaborator

Released in v25.0.0-alpha.6

Please give it a shot! It worked well with my mock S3 uploads (minio server) but would like to hear the results of it being used in the wild. Happy to make iterations on the implementation as needed

Looks like I forgot to update the CLI doc files, so I'll get to that next.

CLI is as follows

electron-builder publish -f <filepath> -f <filepath2> -v <buildVersion (if needed) -c <config file>

Only -f/--files are required, but depending on your publish target or custom config filename, you may need to provide the other args.

API:

const electronBuilder = require('electron-builder')

electronBuilder.publish(args:  { files: string[]; version? string; config?: string })
// OR
electronBuilder.publishArtifactsWithOptions(uploadOptions: { file: string; arch: string | null }[], buildVersion: string?, configurationFilePath?: string, publishConfiguration?: Publish)
seanssel

seanssel commented on Apr 1, 2025

@seanssel

@mmaietta I'm probably missing something, but when I try to use the cli with a js config that extends a base config I get an unable to find any publish configuration error.

E.g. I have an electron-builder-common.js config without a publish configuration. My electron-builder-staging.js config extends common and has a publish configuration at the top level.

mmaietta

mmaietta commented on Apr 1, 2025

@mmaietta
Collaborator

Please open a new issue for your request since this issue is already resolved.

Without much info to go on, my best guess is that your CLI invocation of the publish command is not pointing to the config with the -c path/to/electron-builder-staging.js. Nonetheless, please open a new Github issue and follow the issue template to include the necessary relevant data.

choegyumin

choegyumin commented on Jul 31, 2025

@choegyumin
Contributor

This issue has been resolved, but I'm leaving this here for anyone searching for related keywords. (This page comes up first in Google search results)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @suan@RobertLowe@hgouveia@cawa-93@cinan

      Issue actions

        How to only publish? · Issue #4535 · electron-userland/electron-builder