-
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 <[email protected]>
- 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,8 +49,8 @@ tauri *ARGS: | |
[doc('build the tauri app for testing')] | ||
tauri-b-for-tests: | ||
#!/bin/bash | ||
if [ -n "$VERBOSE" ]; then set -x; fi | ||
set -euo pipefail | ||
if [ -n "$TRACE" ]; then set -x; fi | ||
set -euov pipefail | ||
just tauri build --bundles=none | ||
test -f $PATH_TAURI_RELEASE_BINARY | ||
|
||
|
@@ -78,7 +78,7 @@ webdriver-url: | |
[windows] | ||
webdriver-download: init | ||
#!/bin/bash | ||
if [ -n "$VERBOSE" ]; then set -x; fi | ||
if [ -n "$TRACE" ]; then set -x; fi | ||
set -euo pipefail | ||
|
||
version=$(just browser-version) | ||
|
@@ -110,7 +110,7 @@ webdriver-download: init | |
[unix] | ||
webdriver-download: | ||
#!/bin/bash | ||
if [ -n "$VERBOSE" ]; then set -x; fi | ||
if [ -n "$TRACE" ]; then set -x; fi | ||
set -euo pipefail | ||
if [ -n "$PATH_WEBDRIVER_BINARY" ] && [ -f $PATH_WEBDRIVER_BINARY ]; then | ||
echo "Webdriver found at: '$PATH_WEBDRIVER_BINARY'" | ||
|
@@ -164,6 +164,56 @@ clippy-fix extra="": | |
fmt: | ||
cargo fmt -- | ||
|
||
export RELEASE_PLEASE_REV := "ace2bd5dc778f83c33ad5dee6807db5d0afdba36" | ||
export RELEASE_PLEASE_TOKEN := env_var_or_default('RELEASE_PLEASE_TOKEN', '') | ||
|
||
[group('release')] | ||
[doc('cleans release-please dir')] | ||
[confirm] | ||
clean-release-please: | ||
rm -rf .github/release-please | ||
|
||
[group('release')] | ||
[doc('pulls and builds release-please with patches')] | ||
build-release-please: | ||
#!/bin/bash | ||
if [ -n "$TRACE" ]; then set -x; fi | ||
set -euov pipefail | ||
cd .github/ | ||
# clone only if the directory doesn't exist | ||
[ -d release-please ] || git clone [email protected]:googleapis/release-please.git | ||
cd release-please | ||
git checkout $RELEASE_PLEASE_REV | ||
# apply patches only if they haven't been applied | ||
patch_files=$(ls ../patches/release-please/**.patch) | ||
for patch_file in "${patch_files[@]}"; do | ||
if git apply --check $patch_file; then | ||
git apply $patch_file | ||
fi | ||
done | ||
npm install | ||
|
||
[group('release')] | ||
[doc('run PR with release-please')] | ||
release-please-pr: | ||
#!/bin/bash | ||
set -euov pipefail | ||
# if token is not set, then exit | ||
if [ -z "$RELEASE_PLEASE_TOKEN" ]; then | ||
echo "RELEASE_PLEASE_TOKEN is not set" | ||
exit 1 | ||
fi | ||
cd .github/release-please | ||
git checkout $RELEASE_PLEASE_REV | ||
node ./build/src/bin/release-please.js release-pr \ | ||
--repo-url=https://github.com/bukowa/ck3oop \ | ||
--config-file=.github/release-please-config.json \ | ||
--manifest-file=.github/.release-please-manifest.json \ | ||
--token=$RELEASE_PLEASE_TOKEN \ | ||
--monorepo-tags | ||
|
||
[group('release')] | ||
[doc('mark correct release as latest')] | ||
release-mark-latest: | ||
#!/bin/bash | ||
release_id=$( | ||
|