mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
ci: Fix daily alpha workflow to just create the next alpha
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
f2070a1e4c
commit
54e7f10ca5
7 files changed
+14
-201
No files matched your search
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/swcrc",
|
||||
"jsc": {
|
||||
"parser": {
|
||||
"syntax": "typescript"
|
||||
},
|
||||
"target": "es2022"
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
{
|
||||
"name": "@k8slens/bump-version-for-cron",
|
||||
"version": "6.5.0-alpha.4",
|
||||
"description": "CLI to bump the version to during a cron daily alpha release",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"clean": "rimraf dist/",
|
||||
"build": "swc ./src/index.ts -d ./dist",
|
||||
"bump": "node ./dist/index.js"
|
||||
},
|
||||
"type": "module",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"private": false,
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"registry": "https://registry.npmjs.org/"
|
||||
},
|
||||
"dependencies": {
|
||||
"arg": "^5.0.2",
|
||||
"semver": "^7.3.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@swc/cli": "^0.1.62",
|
||||
"@swc/core": "^1.3.53",
|
||||
"@types/node": "^16.18.24",
|
||||
"@types/semver": "^7.3.13",
|
||||
"rimraf": "^4.4.1"
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
import * as child_process from "child_process";
|
||||
import { readFile, writeFile } from "fs/promises";
|
||||
import semver from "semver";
|
||||
import { promisify } from "util";
|
||||
import arg from "arg";
|
||||
|
||||
const { SemVer } = semver;
|
||||
|
||||
const exec = promisify(child_process.exec);
|
||||
|
||||
const args = arg({
|
||||
"--path": String,
|
||||
});
|
||||
|
||||
const versionJsonPath = args["--path"];
|
||||
|
||||
if (!versionJsonPath) {
|
||||
throw new Error("Missing required '--path'");
|
||||
}
|
||||
|
||||
try {
|
||||
const packageJson = JSON.parse(await readFile(versionJsonPath, "utf-8"));
|
||||
|
||||
const { stdout: gitRevParseOutput } = await exec("git rev-parse --short HEAD");
|
||||
const currentHash = gitRevParseOutput.trim();
|
||||
|
||||
const currentVersion = new SemVer(packageJson.version);
|
||||
|
||||
const partialVersion = `${currentVersion.major}.${currentVersion.minor}.${currentVersion.patch}`;
|
||||
const prereleasePart = `cron.${currentHash}`;
|
||||
const newVersion = `${partialVersion}-${prereleasePart}`;
|
||||
|
||||
await writeFile(
|
||||
versionJsonPath,
|
||||
JSON.stringify(
|
||||
{
|
||||
...packageJson,
|
||||
version: newVersion,
|
||||
},
|
||||
null,
|
||||
2,
|
||||
),
|
||||
);
|
||||
|
||||
if (process.env.GITHUB_OUTPUT) {
|
||||
await writeFile(process.env.GITHUB_OUTPUT, `VERSION=${newVersion}`, {
|
||||
flag: "a+",
|
||||
});
|
||||
}
|
||||
|
||||
await exec(`npm run bump-version ${newVersion} -- --yes`);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"outDir": "dist/",
|
||||
"paths": {
|
||||
"*": [
|
||||
"node_modules/*",
|
||||
"types/*"
|
||||
]
|
||||
},
|
||||
},
|
||||
"include": [
|
||||
"src/**/*",
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
]
|
||||
}
|
||||
@@ -79,8 +79,9 @@ async function fetchAllGitTags(): Promise<string[]> {
|
||||
}
|
||||
|
||||
function bumpPackageVersions() {
|
||||
const bumpPackages = spawn("npm", ["run", "bump-version"], {
|
||||
stdio: "inherit"
|
||||
const bumpPackages = spawn(`npm run bump-version ${process.env.BUMP_PACKAGE_ARGS ?? ""}`, {
|
||||
stdio: "inherit",
|
||||
shell: true,
|
||||
});
|
||||
const cleaners: (() => void)[] = [
|
||||
() => bumpPackages.stdout?.unpipe(),
|
||||
@@ -153,7 +154,7 @@ async function createReleaseBranchAndCommit(prBase: string, version: SemVer, prB
|
||||
const prBranch = `release/v${version.format()}`;
|
||||
|
||||
await pipeExecFile("git", ["checkout", "-b", prBranch]);
|
||||
await pipeExecFile("git", ["add", "packages/*/package.json", "package-lock.json"]);
|
||||
await pipeExecFile("git", ["add", "."]);
|
||||
await pipeExecFile("git", ["commit", "-sm", `Release ${version.format()}`]);
|
||||
await pipeExecFile("git", ["push", "--set-upstream", "origin", prBranch]);
|
||||
|
||||
@@ -354,6 +355,12 @@ async function createRelease(): Promise<void> {
|
||||
}
|
||||
|
||||
const selectedPrs = await pickRelevantPrs(relevantPrs, isMasterBranch);
|
||||
|
||||
if (selectedPrs.length === 0) {
|
||||
console.log(`No PRs have been found relating to ${previousReleasedVersion}, stopping...`);
|
||||
return;
|
||||
}
|
||||
|
||||
const prBody = formatChangelog(previousReleasedVersion, selectedPrs);
|
||||
|
||||
if (!isMasterBranch) {
|
||||
|
||||
Reference in new issue
Block a user