Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cynthia_websites_mini_client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Cynthia Mini's client package

Cynthia Mini consists of two packages: A client (you are here) and a server (cynthia_websites_mini_server).

To install or use Cynthia Mini, please refer to [GitHub releases](https://github.com/CynthiaWebsiteEngine/Mini/releases).
5 changes: 5 additions & 0 deletions cynthia_websites_mini_server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Cynthia Mini's server package

Cynthia Mini consists of two packages: A client (cynthia_websites_mini_client) and a server (you are here).

To install or use Cynthia Mini, please refer to [GitHub releases](https://github.com/CynthiaWebsiteEngine/Mini/releases).
2 changes: 1 addition & 1 deletion cynthia_websites_mini_server/gleam.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ gleam_fetch = "1.3.0"
argv = "1.0.2"
birl = "1.8.0"
conversation = "2.0.1"
bungibindies = { git = "https://github.com/strawmelonjuice/bungibindies.git", ref = "main" }
bungibindies = "1.2.0-rc"
cynthia_websites_mini_client = { path = "../cynthia_websites_mini_client" }
edit_distance = "2.0.1"
envoy = "1.0.2"
Expand Down
2 changes: 1 addition & 1 deletion cynthia_websites_mini_server/manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ packages = [
{ name = "birl", version = "1.8.0", build_tools = ["gleam"], requirements = ["gleam_regexp", "gleam_stdlib", "ranger"], otp_app = "birl", source = "hex", outer_checksum = "2AC7BA26F998E3DFADDB657148BD5DDFE966958AD4D6D6957DD0D22E5B56C400" },
{ name = "bungibindies", version = "1.1.8", build_tools = ["gleam"], requirements = ["gleam_javascript", "gleam_stdlib"], source = "git", repo = "https://github.com/strawmelonjuice/bungibindies.git", commit = "350be6716c308771bbdfbb3f53d6f50e100c6a21" },
{ name = "conversation", version = "2.0.1", build_tools = ["gleam"], requirements = ["gleam_http", "gleam_javascript", "gleam_stdlib"], otp_app = "conversation", source = "hex", outer_checksum = "103DF47463B8432AB713D6643DC17244B9C82E2B172A343150805129FE584A2F" },
{ name = "cynthia_websites_mini_client", version = "1.1.6", build_tools = ["gleam"], requirements = ["gleam_community_colour", "gleam_fetch", "gleam_http", "gleam_javascript", "gleam_json", "gleam_stdlib", "gleam_time", "houdini", "jot", "lustre", "modem", "odysseus", "plinth", "rsvp"], source = "local", path = "../cynthia_websites_mini_client" },
{ name = "cynthia_websites_mini_client", version = "1.2.0-rc", build_tools = ["gleam"], requirements = ["gleam_community_colour", "gleam_fetch", "gleam_http", "gleam_javascript", "gleam_json", "gleam_stdlib", "gleam_time", "houdini", "jot", "lustre", "modem", "odysseus", "plinth", "rsvp"], source = "local", path = "../cynthia_websites_mini_client" },
{ name = "edit_distance", version = "2.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "edit_distance", source = "hex", outer_checksum = "A1E485C69A70210223E46E63985FA1008B8B2DDA9848B7897469171B29020C05" },
{ name = "envoy", version = "1.0.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "envoy", source = "hex", outer_checksum = "95FD059345AA982E89A0B6E2A3BF1CF43E17A7048DCD85B5B65D3B9E4E39D359" },
{ name = "filepath", version = "1.1.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "B06A9AF0BF10E51401D64B98E4B627F1D2E48C154967DA7AF4D0914780A6D40A" },
Expand Down
80 changes: 71 additions & 9 deletions mise/tasks/new-release
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ if (mainBranch !== "main") {
}

// Now, we want to know if the user wants to bump the version or set it to a specific value. The optional parameter is either "bump" or "set", followed by the version number.
// It can also be `x.x.x` instead of `set`, or `+x.x.x` instead of `bump`, as a shorthand for the same operation.
// It can also be `x.x.x` instead of `set`, or `+x.x.x` instead of `bump`, as a shorthand for the same operation.
// (The x's are numbers in this case, e.g., `+0.2.0` bumps the minor version by 2, while `1.2.3` sets the version to 1.2.3., you could call these 'relative' or 'absolute'.)
if (args.length === 0) {
console.error("Please provide a version to bump or set. Usage: new-release <bump|set> <version>");
Expand Down Expand Up @@ -165,18 +165,80 @@ if (!noCommit) {
console.log("Skipping commit and tag as --no-commit flag is set.");
}

// Push the changes and the new tag to the remote repository
// Push commits, publish Gleam packages, then push the tag to the remote repository
if (noPush) {
console.log("Skipping push to remote repository as --no-push flag is set.");
}
else if (!noCommit) {
const pushResult = Bun.spawnSync(["git", "push", "origin", `v${newVersion}`], {
cwd: config_root,
});
if (pushResult.exitCode !== 0) {
console.error("Failed to push changes to the remote repository. Please check the output above for details.");
if (pushResult.stderr) {
console.error(pushResult.stderr.toString());
// First push the commits
const pushCommits = Bun.spawnSync(["git", "push"], { cwd: config_root });
if (pushCommits.exitCode !== 0) {
console.error("Failed to push commits to the remote repository. Please check the output above for details.");
if (pushCommits.stderr) {
console.error(pushCommits.stderr.toString());
}
process.exit(1);
}

// Publish client first
const clientDir = join(config_root, "cynthia_websites_mini_client");
const serverDir = join(config_root, "cynthia_websites_mini_server");
console.log("Running 'gleam publish -y' in client directory...");
const clientPublish = Bun.spawnSync(["gleam", "publish", "-y"], { cwd: clientDir });
if (clientPublish.exitCode !== 0) {
console.error("Failed to publish client package via Gleam.");
if (clientPublish.stderr) {
console.error(clientPublish.stderr.toString());
}
process.exit(1);
}

// Temporarily replace server's path dependency on client with a version string
const serverTomlPath = join(serverDir, "gleam.toml");
const serverTomlOrig = await Bun.file(serverTomlPath).text();
const pathDepRegex = /cynthia_websites_mini_client\s*=\s*\{\s*path\s*=\s*"\.\.\/cynthia_websites_mini_client"\s*\}/;
const versionDepLine = `cynthia_websites_mini_client = "${newVersion}"`;
const serverTomlUpdated = serverTomlOrig.replace(pathDepRegex, versionDepLine);
if (serverTomlOrig !== serverTomlUpdated) {
try {
await Bun.write(serverTomlPath, serverTomlUpdated);
} catch (err) {
console.error("Failed to update server gleam.toml to version dependency.");
process.exit(1);
}
} else {
console.warn("Warning: Could not find path dependency for client in server's gleam.toml; proceeding.");
}

// Publish server second
console.log("Running 'gleam publish -y' in server directory...");
const serverPublish = Bun.spawnSync(["gleam", "publish", "-y"], { cwd: serverDir });
if (serverPublish.exitCode !== 0) {
console.error("Failed to publish server package via Gleam.");
if (serverPublish.stderr) {
console.error(serverPublish.stderr.toString());
}
// Attempt to revert the gleam.toml if modified
try { await Bun.write(serverTomlPath, serverTomlOrig); } catch { }
process.exit(1);
}

// Revert server gleam.toml back to path dependency
if (serverTomlOrig !== serverTomlUpdated) {
try {
await Bun.write(serverTomlPath, serverTomlOrig);
} catch (err) {
console.error("Failed to revert server gleam.toml back to path dependency.");
process.exit(1);
}
}

// Then push the tag
const pushTag = Bun.spawnSync(["git", "push", "origin", `v${newVersion}`], { cwd: config_root });
if (pushTag.exitCode !== 0) {
console.error("Failed to push tag to the remote repository. Please check the output above for details.");
if (pushTag.stderr) {
console.error(pushTag.stderr.toString());
}
process.exit(1);
}
Expand Down