uptime-kuma/extra/release/beta.mjs

65 lines
1.7 KiB
JavaScript
Raw Normal View History

2024-10-29 11:02:49 +00:00
import "dotenv/config";
import {
ver,
buildDist,
buildImage,
checkDocker,
checkTagExists,
checkVersionFormat,
getRepoNames,
2024-10-29 11:02:49 +00:00
pressAnyKey,
execSync, uploadArtifacts,
} from "./lib.mjs";
import semver from "semver";
const repoNames = getRepoNames();
2024-10-29 11:02:49 +00:00
const version = process.env.RELEASE_BETA_VERSION;
const githubToken = process.env.RELEASE_GITHUB_TOKEN;
console.log("RELEASE_BETA_VERSION:", version);
if (!githubToken) {
console.error("GITHUB_TOKEN is required");
process.exit(1);
}
// Check if the version is a valid semver
checkVersionFormat(version);
// Check if the semver identifier is "beta"
const semverIdentifier = semver.prerelease(version);
console.log("Semver identifier:", semverIdentifier);
if (semverIdentifier[0] !== "beta") {
console.error("VERSION should have a semver identifier of 'beta'");
process.exit(1);
}
// Check if docker is running
checkDocker();
// Check if the tag exists
await checkTagExists(repoNames, version);
2024-10-29 11:02:49 +00:00
// node extra/beta/update-version.js
execSync("node ./extra/beta/update-version.js");
// Build frontend dist
buildDist();
// Build slim image (rootless)
buildImage(repoNames, [ "beta-slim-rootless", ver(version, "slim-rootless") ], "rootless", "BASE_IMAGE=louislam/uptime-kuma:base2-slim");
2024-10-29 11:02:49 +00:00
// Build full image (rootless)
buildImage(repoNames, [ "beta-rootless", ver(version, "rootless") ], "rootless");
2024-10-29 11:02:49 +00:00
// Build slim image
buildImage(repoNames, [ "beta-slim", ver(version, "slim") ], "release", "BASE_IMAGE=louislam/uptime-kuma:base2-slim");
2024-10-29 11:02:49 +00:00
// Build full image
buildImage(repoNames, [ "beta", version ], "release");
2024-10-29 11:02:49 +00:00
await pressAnyKey();
// npm run upload-artifacts
2024-10-29 14:10:05 +00:00
uploadArtifacts(version, githubToken);