feat(electron-publish): add targetCommitish support for GitHub releases#9626
feat(electron-publish): add targetCommitish support for GitHub releases#9626EYadroshnikov wants to merge 2 commits intoelectron-userland:masterfrom
Conversation
Allow specifying branch or commit for release creation via config, EP_TARGET_COMMITISH or GITHUB_SHA env vars
🦋 Changeset detectedLatest commit: b192372 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
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 |
|
@mmaietta, this is ready for review whenever you have some time. Thanks! |
mmaietta
left a comment
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
Nit: We can simplify this to !!this.targetCommitish?.length (or use isEmptyOrSpaces from builder-util)
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:
development,release/1.0)GITHUB_SHAin GitHub Actions)Changes
GithubOptions(builder-util-runtime): Added optionaltargetCommitishfieldGitHubPublisher(electron-publish): ResolvestargetCommitishfrom config,EP_TARGET_COMMITISH, orGITHUB_SHAenv vars and passes it astarget_commitishin the GitHub API requestapp-builder-lib/scheme.json): AddedtargetCommitishpropertypages/publish.md): Added usage examples and env var notesGitHubPublisherTest.tscovering config, env vars, and precedenceUsage
Config: