-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tools(release): add
justfile
recipe to run release-please
with cu…
…stom git patches googleapis/release-please#2320 Signed-off-by: Bukowa <gitbukowa@gmail.com>
- Loading branch information
Showing
3 changed files
with
139 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
release-please |
84 changes: 84 additions & 0 deletions
84
.github/patches/release-please/fix__use_strategies_for_rust_workspace_plugin.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
Subject: [PATCH] fix: use strategies for rust workspace plugin | ||
--- | ||
Index: src/plugins/cargo-workspace.ts | ||
IDEA additional info: | ||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | ||
<+>UTF-8 | ||
=================================================================== | ||
diff --git a/src/plugins/cargo-workspace.ts b/src/plugins/cargo-workspace.ts | ||
--- a/src/plugins/cargo-workspace.ts (revision 3895d8987cf194cb33a13b725a8380071917322f) | ||
+++ b/src/plugins/cargo-workspace.ts (revision 2238df955e907c55c71a28d3149462a2df648941) | ||
@@ -38,6 +38,9 @@ | ||
import {PatchVersionUpdate} from '../versioning-strategy'; | ||
import {CargoLock} from '../updaters/rust/cargo-lock'; | ||
import {ConfigurationError} from '../errors'; | ||
+import {Strategy} from '../strategy'; | ||
+import {Commit} from '../commit'; | ||
+import {Release} from '../release'; | ||
|
||
interface CrateInfo { | ||
/** | ||
@@ -79,6 +82,9 @@ | ||
* into a single rust package. | ||
*/ | ||
export class CargoWorkspace extends WorkspacePlugin<CrateInfo> { | ||
+ private strategiesByPath: Record<string, Strategy> = {}; | ||
+ private releasesByPath: Record<string, Release> = {}; | ||
+ | ||
protected async buildAllPackages( | ||
candidates: CandidateReleasePullRequest[] | ||
): Promise<{ | ||
@@ -252,6 +258,34 @@ | ||
originalManifest, | ||
updatedManifest | ||
); | ||
+ | ||
+ const updatedPackage = { | ||
+ ...pkg, | ||
+ version: version.toString(), | ||
+ }; | ||
+ | ||
+ const strategy = this.strategiesByPath[updatedPackage.path]; | ||
+ const latestRelease = this.releasesByPath[updatedPackage.path]; | ||
+ const basePullRequest = strategy | ||
+ ? await strategy.buildReleasePullRequest([], latestRelease, false, [], { | ||
+ newVersion: version, | ||
+ }) | ||
+ : undefined; | ||
+ | ||
+ if (basePullRequest) { | ||
+ return this.updateCandidate( | ||
+ { | ||
+ path: pkg.path, | ||
+ pullRequest: basePullRequest, | ||
+ config: { | ||
+ releaseType: 'rust', | ||
+ }, | ||
+ }, | ||
+ pkg, | ||
+ updatedVersions | ||
+ ); | ||
+ } | ||
+ | ||
const pullRequest: ReleasePullRequest = { | ||
title: PullRequestTitle.ofTargetBranch(this.targetBranch), | ||
body: new PullRequestBody([ | ||
@@ -367,6 +401,18 @@ | ||
protected pathFromPackage(pkg: CrateInfo): string { | ||
return pkg.path; | ||
} | ||
+ | ||
+ async preconfigure( | ||
+ strategiesByPath: Record<string, Strategy>, | ||
+ _commitsByPath: Record<string, Commit[]>, | ||
+ _releasesByPath: Record<string, Release> | ||
+ ): Promise<Record<string, Strategy>> { | ||
+ // Using preconfigure to siphon releases and strategies. | ||
+ this.strategiesByPath = strategiesByPath; | ||
+ this.releasesByPath = _releasesByPath; | ||
+ | ||
+ return strategiesByPath; | ||
+ } | ||
} | ||
|
||
function getChangelogDepsNotes( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters