Skip to content

Commit 2d60be4

Browse files
authored
Merge pull request #202 from morri-son/enhance-controller-release-v2
Enhance controller release v2
2 parents 5eb1214 + dd74dce commit 2d60be4

File tree

3 files changed

+72
-73
lines changed

3 files changed

+72
-73
lines changed

.github/scripts/release-versioning.js

Lines changed: 70 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,76 @@
22
import { execFileSync } from "child_process";
33

44
// --------------------------
5-
// Helpers
5+
// GitHub Actions entrypoint
6+
// --------------------------
7+
// noinspection JSUnusedGlobalSymbols
8+
/** @param {import('@actions/github-script').AsyncFunctionArguments} args */
9+
export default async function computeRcVersion({ core }) {
10+
const componentPath = process.env.COMPONENT_PATH;
11+
const releaseBranch = process.env.BRANCH;
12+
if (!componentPath || !releaseBranch) {
13+
core.setFailed("Missing COMPONENT_PATH or BRANCH");
14+
return;
15+
}
16+
17+
const basePrefix = parseBranch(releaseBranch);
18+
const tagPrefix = `${componentPath}/v`;
19+
20+
// Get latest stable tag using Git's native version sort (descending)
21+
// Filter out RC tags after fetching since git doesn't support negative pattern matching
22+
const stableTags = run(core, "git", [
23+
"tag", "--list", `${tagPrefix}${basePrefix}.*`,
24+
"--sort=-version:refname"
25+
]);
26+
const latestStable = stableTags
27+
.split("\n")
28+
.filter(tag => tag && !/-rc\.\d+$/.test(tag))[0] || "";
29+
30+
// Get latest RC tag using Git's native version sort (descending)
31+
const rcTags = run(core, "git", [
32+
"tag", "--list", `${tagPrefix}${basePrefix}.*-rc.*`,
33+
"--sort=-version:refname"
34+
]);
35+
const latestRc = rcTags.split("\n").filter(Boolean)[0] || "";
36+
37+
core.info(`Latest stable: ${latestStable || "(none)"}`);
38+
core.info(`Latest RC: ${latestRc || "(none)"}`);
39+
40+
const { baseVersion, rcVersion } = computeNextVersions(basePrefix, latestStable, latestRc, false);
41+
42+
const rcTag = `${tagPrefix}${rcVersion}`;
43+
const promotionTag = `${tagPrefix}${baseVersion}`;
44+
45+
core.setOutput("new_tag", rcTag);
46+
core.setOutput("new_version", rcVersion);
47+
core.setOutput("base_version", baseVersion);
48+
core.setOutput("promotion_tag", promotionTag);
49+
50+
// --------------------------
51+
// Step summary
52+
// --------------------------
53+
await core.summary
54+
.addHeading("📦 RC Version Computation")
55+
.addTable([
56+
[
57+
{ data: "Field", header: true },
58+
{ data: "Value", header: true },
59+
],
60+
["Component Path", componentPath],
61+
["Release Branch", releaseBranch],
62+
["Base Prefix", basePrefix],
63+
["Latest Stable", latestStable || "(none)"],
64+
["Latest RC", latestRc || "(none)"],
65+
["Next Base Version", baseVersion],
66+
["Next RC Version", rcVersion],
67+
["RC Tag", rcTag],
68+
["Promotion Tag", promotionTag],
69+
])
70+
.write();
71+
}
72+
73+
// --------------------------
74+
// Core helpers
675
// --------------------------
776
/**
877
* Run a shell command safely using execFileSync.
@@ -188,73 +257,3 @@ export function extractHighestFinalVersion(releases, tagPrefix) {
188257
export function shouldSetLatest(promotionVersion, highestFinal) {
189258
return !highestFinal || !isStableNewer(`v${highestFinal}`, `v${promotionVersion}`);
190259
}
191-
192-
// --------------------------
193-
// GitHub Actions entrypoint
194-
// --------------------------
195-
// noinspection JSUnusedGlobalSymbols
196-
/** @param {import('@actions/github-script').AsyncFunctionArguments} args */
197-
export default async function computeRcVersion({ core }) {
198-
const componentPath = process.env.COMPONENT_PATH;
199-
const releaseBranch = process.env.BRANCH;
200-
if (!componentPath || !releaseBranch) {
201-
core.setFailed("Missing COMPONENT_PATH or BRANCH");
202-
return;
203-
}
204-
205-
const basePrefix = parseBranch(releaseBranch);
206-
const tagPrefix = `${componentPath}/v`;
207-
208-
// Get latest stable tag using Git's native version sort (descending)
209-
// Filter out RC tags after fetching since git doesn't support negative pattern matching
210-
const stableTags = run(core, "git", [
211-
"tag", "--list", `${tagPrefix}${basePrefix}.*`,
212-
"--sort=-version:refname"
213-
]);
214-
const latestStable = stableTags
215-
.split("\n")
216-
.filter(tag => tag && !/-rc\.\d+$/.test(tag))[0] || "";
217-
218-
// Get latest RC tag using Git's native version sort (descending)
219-
const rcTags = run(core, "git", [
220-
"tag", "--list", `${tagPrefix}${basePrefix}.*-rc.*`,
221-
"--sort=-version:refname"
222-
]);
223-
const latestRc = rcTags.split("\n").filter(Boolean)[0] || "";
224-
225-
core.info(`Latest stable: ${latestStable || "(none)"}`);
226-
core.info(`Latest RC: ${latestRc || "(none)"}`);
227-
228-
const { baseVersion, rcVersion } = computeNextVersions(basePrefix, latestStable, latestRc, false);
229-
230-
const rcTag = `${tagPrefix}${rcVersion}`;
231-
const promotionTag = `${tagPrefix}${baseVersion}`;
232-
233-
core.setOutput("new_tag", rcTag);
234-
core.setOutput("new_version", rcVersion);
235-
core.setOutput("base_version", baseVersion);
236-
core.setOutput("promotion_tag", promotionTag);
237-
238-
// --------------------------
239-
// Step summary
240-
// --------------------------
241-
await core.summary
242-
.addHeading("📦 RC Version Computation")
243-
.addTable([
244-
[
245-
{ data: "Field", header: true },
246-
{ data: "Value", header: true },
247-
],
248-
["Component Path", componentPath],
249-
["Release Branch", releaseBranch],
250-
["Base Prefix", basePrefix],
251-
["Latest Stable", latestStable || "(none)"],
252-
["Latest RC", latestRc || "(none)"],
253-
["Next Base Version", baseVersion],
254-
["Next RC Version", rcVersion],
255-
["RC Tag", rcTag],
256-
["Promotion Tag", promotionTag],
257-
])
258-
.write();
259-
}
260-

.github/workflows/conformance.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ concurrency:
3434
cancel-in-progress: true
3535

3636
env:
37-
CLI_IMAGE: ${{ inputs.cli_image || 'ghcr.io/open-component-model/cli:main' }}
37+
CLI_IMAGE: ${{ inputs.cli_image || 'ghcr.io/open-component-model/cli:0.0.0-main' }}
3838
TOOLKIT_IMAGE: ${{ inputs.toolkit_image || 'ghcr.io/open-component-model/kubernetes/controller/chart:0.0.0-c837a09' }}
3939

4040
jobs:

kubernetes/controller/cliff.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ you can use our Helm chart:
2929
helm install ocm-k8s-toolkit oci://ghcr.io/open-component-model/charts/ocm-k8s-toolkit \
3030
--namespace ocm-k8s-toolkit-system \
3131
--create-namespace
32-
``
32+
```
3333
3434
Check out our [guide](https://ocm.software/dev/docs/getting-started/set-up-controller-environments/) on how to set up
3535
OCM Controller environments for more details.

0 commit comments

Comments
 (0)