Skip to content
This repository was archived by the owner on Oct 22, 2025. It is now read-only.

Commit d52dab7

Browse files
committed
chore: release version 0.9.0-rc.1
1 parent 38cccb2 commit d52dab7

File tree

1 file changed

+55
-37
lines changed

1 file changed

+55
-37
lines changed

scripts/release.ts

Lines changed: 55 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ async function main() {
99
// Check if cargo, maturin etc. exist
1010
await checkRustEnvironment();
1111
await checkPythonEnvironment();
12-
12+
1313
// Update version
1414
const version = getVersionFromArgs();
1515
await bumpPackageVersions(version);
@@ -20,21 +20,20 @@ async function main() {
2020
// Check & build
2121
await runTypeCheck();
2222
await runRustCheck();
23-
await runPythonCheck();
2423
await runBuild();
2524

2625
// Commit
2726
await commitVersionChanges(version);
28-
27+
2928
// Get packages ready for publishing
3029
const publicPackages = await getPublicPackages();
3130
validatePackages(publicPackages);
32-
31+
3332
// Publish
3433
await publishPackages(publicPackages, version);
3534
await publishRustClient(version);
3635
//await publishPythonClient(version); // TODO: Add back
37-
36+
3837
// Create GitHub release
3938
await createAndPushTag(version);
4039
await createGitHubRelease(version);
@@ -68,7 +67,7 @@ async function runBuild() {
6867
async function updateRustClientVersion(version: string) {
6968
console.log(chalk.blue(`Updating Rust client version to ${version}...`));
7069
const cargoTomlPath = "clients/rust/Cargo.toml";
71-
70+
7271
try {
7372
// Replace version in Cargo.toml
7473
await $`sed -i.bak -e 's/^version = ".*"/version = "${version}"/' ${cargoTomlPath}`;
@@ -84,7 +83,7 @@ async function updatePythonClientVersion(version: string) {
8483
console.log(chalk.blue(`Updating Python client version to ${version}...`));
8584
const pyprojectTomlPath = "clients/python/pyproject.toml";
8685
const pyCargoTomlPath = "clients/python/Cargo.toml";
87-
86+
8887
try {
8988
// Replace version in pyproject.toml and Cargo.toml
9089
await $`sed -i.bak -e 's/^version = ".*"/version = "${version}"/' ${pyprojectTomlPath}`;
@@ -125,10 +124,10 @@ async function createAndPushTag(version: string) {
125124
try {
126125
// Create tag and force update if it exists
127126
await $`git tag -f v${version}`;
128-
127+
129128
// Push tag with force to ensure it's updated
130129
await $`git push origin v${version} -f`;
131-
130+
132131
console.log(chalk.green(`✅ Tag v${version} created and pushed`));
133132
} catch (err) {
134133
console.error(chalk.red("❌ Failed to create or push tag"), err);
@@ -138,36 +137,36 @@ async function createAndPushTag(version: string) {
138137

139138
async function publishRustClient(version: string) {
140139
console.log(chalk.blue("Publishing Rust client..."));
141-
140+
142141
try {
143142
// First check if we need to update the publish flag in Cargo.toml
144143
const cargoTomlPath = "clients/rust/Cargo.toml";
145144
const { stdout: cargoToml } = await $`cat ${cargoTomlPath}`;
146-
145+
147146
// Check if publish = false is set and update it if needed
148147
if (cargoToml.includes("publish = false")) {
149148
await $`sed -i.bak -e 's/publish = false/publish = true/' ${cargoTomlPath}`;
150149
await $`rm ${cargoTomlPath}.bak`;
151150
console.log(chalk.blue("Updated publish flag in Cargo.toml"));
152151
}
153-
152+
154153
// Check if package already exists
155154
const { exitCode } = await $({
156155
nothrow: true,
157156
})`cargo search actor-core-client --limit 1 | grep "actor-core-client = \\"${version}\\""`;
158-
157+
159158
if (exitCode === 0) {
160159
console.log(
161160
chalk.yellow(
162-
`! Rust package actor-core-client@${version} already published, skipping`
163-
)
161+
`! Rust package actor-core-client@${version} already published, skipping`,
162+
),
164163
);
165164
return;
166165
}
167-
166+
168167
// Publish the crate
169168
await $({ stdio: "inherit" })`cd clients/rust && cargo publish`;
170-
169+
171170
console.log(chalk.green("✅ Published Rust client"));
172171
} catch (err) {
173172
console.error(chalk.red("❌ Failed to publish Rust client"), err);
@@ -177,33 +176,37 @@ async function publishRustClient(version: string) {
177176

178177
async function publishPythonClient(version: string) {
179178
console.log(chalk.blue("Publishing Python client..."));
180-
179+
181180
try {
182181
// Check if package already exists
183-
const res = await fetch("https://test.pypi.org/pypi/actor-core-client/json")
182+
const res = await fetch(
183+
"https://test.pypi.org/pypi/actor-core-client/json",
184+
);
184185
if (res.ok) {
185186
const data = await res.json();
186187
const doesAlreadyExist = typeof data.releases[version] !== "undefined";
187188

188189
if (doesAlreadyExist) {
189190
console.log(
190191
chalk.yellow(
191-
`! Python pypi package actor-core-client@${version} already published, skipping`
192-
)
192+
`! Python pypi package actor-core-client@${version} already published, skipping`,
193+
),
193194
);
194195
return;
195196
}
196197
}
197198

198199
const token = process.env["PYPI_TOKEN"];
199200
if (!token) {
200-
console.error(chalk.red("❌ Missing PyPi credentials (PYPI_TOKEN env var)"));
201+
console.error(
202+
chalk.red("❌ Missing PyPi credentials (PYPI_TOKEN env var)"),
203+
);
201204
process.exit(1);
202205
}
203206

204207
const username = "__token__";
205208
const password = token;
206-
209+
207210
// Publish the crate
208211
await $({ stdio: "inherit" })`cd clients/python &&\
209212
maturin publish\
@@ -212,7 +215,7 @@ async function publishPythonClient(version: string) {
212215
--password ${password}\
213216
--skip-existing\
214217
`;
215-
218+
216219
console.log(chalk.green("✅ Published Python client"));
217220
} catch (err) {
218221
console.error(chalk.red("❌ Failed to publish Python client"), err);
@@ -236,7 +239,11 @@ async function checkRustEnvironment() {
236239
}
237240
} catch (err) {
238241
console.error(chalk.red("❌ Rust environment is not ready"));
239-
console.error(chalk.red("Please install Rust and Cargo\n(remember to `cargo login` afterwards)"));
242+
console.error(
243+
chalk.red(
244+
"Please install Rust and Cargo\n(remember to `cargo login` afterwards)",
245+
),
246+
);
240247
process.exit(1);
241248
}
242249
console.log(chalk.green("✅ Rust environment is good"));
@@ -250,7 +257,7 @@ async function checkPythonEnvironment() {
250257
const { stdout: versionText } = await $`pip --version`;
251258

252259
const version = versionText.split(" ")[1];
253-
260+
254261
if (!semver.gte(version, "23.2.1")) {
255262
console.error(chalk.red("❌ Python pip version is too old"));
256263
console.error(chalk.red("Please update Python pip to at least 23.2.1"));
@@ -273,7 +280,9 @@ async function checkPythonEnvironment() {
273280

274281
// Check if PYPI_TOKEN exists
275282
if (!process.env["PYPI_TOKEN"]) {
276-
console.error(chalk.red("❌ Missing PyPi credentials (PYPI_TOKEN env var)"));
283+
console.error(
284+
chalk.red("❌ Missing PyPi credentials (PYPI_TOKEN env var)"),
285+
);
277286
process.exit(1);
278287
}
279288

@@ -380,39 +389,48 @@ async function publishPackages(publicPackages: any[], version: string) {
380389

381390
async function createGitHubRelease(version: string) {
382391
console.log(chalk.blue("Creating GitHub release..."));
383-
392+
384393
try {
385394
// Get the current tag name (should be the tag created during the release process)
386395
const { stdout: currentTag } = await $`git describe --tags --exact-match`;
387396
const tagName = currentTag.trim();
388-
397+
389398
console.log(chalk.blue(`Looking for existing release for ${version}`));
390-
399+
391400
// Check if a release with this version name already exists
392-
const { stdout: releaseJson } = await $`gh release list --json name,tagName`;
401+
const { stdout: releaseJson } =
402+
await $`gh release list --json name,tagName`;
393403
const releases = JSON.parse(releaseJson);
394404
const existingRelease = releases.find((r: any) => r.name === version);
395-
405+
396406
if (existingRelease) {
397-
console.log(chalk.blue(`Updating release ${version} to point to new tag ${tagName}`));
407+
console.log(
408+
chalk.blue(
409+
`Updating release ${version} to point to new tag ${tagName}`,
410+
),
411+
);
398412
await $`gh release edit ${existingRelease.tagName} --tag ${tagName}`;
399413
} else {
400-
console.log(chalk.blue(`Creating new release ${version} pointing to tag ${tagName}`));
414+
console.log(
415+
chalk.blue(
416+
`Creating new release ${version} pointing to tag ${tagName}`,
417+
),
418+
);
401419
await $`gh release create ${tagName} --title ${version} --draft --generate-notes`;
402-
420+
403421
// Check if this is a pre-release (contains -rc. or similar)
404422
if (version.includes("-")) {
405423
await $`gh release edit ${tagName} --prerelease`;
406424
}
407425
}
408-
426+
409427
// Check if we have a dist directory with artifacts to upload
410428
const { exitCode } = await $({ nothrow: true })`test -d dist`;
411429
if (exitCode === 0) {
412430
console.log(chalk.blue(`Uploading artifacts for tag ${tagName}`));
413431
await $`gh release upload ${tagName} dist/* --clobber`;
414432
}
415-
433+
416434
console.log(chalk.green("✅ GitHub release created/updated"));
417435
} catch (err) {
418436
console.error(chalk.red("❌ Failed to create GitHub release"), err);

0 commit comments

Comments
 (0)