Skip to content

feat(electron-publish): add targetCommitish support for GitHub releases#9626

Draft
EYadroshnikov wants to merge 2 commits intoelectron-userland:masterfrom
EYadroshnikov:master
Draft

feat(electron-publish): add targetCommitish support for GitHub releases#9626
EYadroshnikov wants to merge 2 commits intoelectron-userland:masterfrom
EYadroshnikov:master

Conversation

@EYadroshnikov
Copy link
Copy Markdown

feat(electron-publish): add targetCommitish support for GitHub releases

Summary

Adds support for specifying which branch or commit GitHub releases are created from. By default, GitHub uses the default branch (e.g. main); this change allows targeting a specific branch (e.g. development) or a commit SHA.

Motivation

Useful when:

  • Releasing from non-default branches (e.g. development, release/1.0)
  • Creating releases from the exact commit built in CI (e.g. GITHUB_SHA in GitHub Actions)

Changes

  • GithubOptions (builder-util-runtime): Added optional targetCommitish field
  • GitHubPublisher (electron-publish): Resolves targetCommitish from config, EP_TARGET_COMMITISH, or GITHUB_SHA env vars and passes it as target_commitish in the GitHub API request
  • Schema (app-builder-lib/scheme.json): Added targetCommitish property
  • Documentation (pages/publish.md): Added usage examples and env var notes
  • Tests: New GitHubPublisherTest.ts covering config, env vars, and precedence

Usage

Config:

{
  "build": {
    "publish": {
      "provider": "github",
      "owner": "my-org",
      "repo": "my-app",
      "targetCommitish": "development"
    }
  }
}

Allow specifying branch or commit for release creation via config, EP_TARGET_COMMITISH or GITHUB_SHA env vars
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 2, 2026

🦋 Changeset detected

Latest commit: b192372

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
electron-publish Major
builder-util-runtime Minor
app-builder-lib Major
builder-util Major
electron-builder Major
electron-updater Patch
dmg-builder Major
electron-builder-squirrel-windows Major
electron-forge-maker-appimage Major
electron-forge-maker-nsis-web Major
electron-forge-maker-nsis Major
electron-forge-maker-snap Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@EYadroshnikov
Copy link
Copy Markdown
Author

@mmaietta, this is ready for review whenever you have some time. Thanks!

Copy link
Copy Markdown
Collaborator

@mmaietta mmaietta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding docs/example! I left a comment re: this being a breaking change since we're adding conditional functionality that impacts prod tagging based on environment variables.
In order to proceed with this PR, I'd advocate for reading only from the config property and then allow it to be opt-in for v26.

Happy to discuss making it the default logic for v27 though!


this.tag = githubTagPrefix(info) + version

this.targetCommitish = info.targetCommitish ?? process.env.EP_TARGET_COMMITISH ?? process.env.GITHUB_SHA ?? undefined
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm hesitant to add the default of process.env.EP_TARGET_COMMITISH ?? process.env.GITHUB_SHA since this is completely net-new functionality and likely not expected by another dev.
I consider new functionality that is extracted from env vars to be breaking changes.

I'd suggest only using info.targetCommitish and then in the tsdoc, specify an example (or recommended) value.

prerelease: this.releaseType === "prerelease",
})
}
if (this.targetCommitish != null && this.targetCommitish.length > 0) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: We can simplify this to !!this.targetCommitish?.length (or use isEmptyOrSpaces from builder-util)

@mmaietta mmaietta marked this pull request as draft May 3, 2026 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants