-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
129 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Draft Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: "Version (must start with 'v')" | ||
required: true | ||
|
||
jobs: | ||
draft-release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- run: corepack enable | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
cache: yarn | ||
|
||
- run: yarn install --immutable | ||
- run: yarn bump-sdk-version ${{ inputs.version }} | ||
|
||
- name: Create draft release | ||
run: | | ||
gh release create "sdk/${{ inputs.version }}" \ | ||
--draft \ | ||
--generate-notes \ | ||
--title "sdk/${{ inputs.version }}" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#!/usr/bin/env tsx | ||
|
||
import { glob } from "glob"; | ||
import fs from "fs/promises"; | ||
import path from "path"; | ||
import { spawn } from "child_process"; | ||
|
||
const versionRegex = /^version\s*=\s*"[^"]*"/m; | ||
|
||
async function main() { | ||
const newVersion = process.argv[2]; | ||
if (!newVersion?.startsWith("v")) { | ||
console.log("Usage: bumpSdkVersion.ts <version>"); | ||
console.log("Version must start with 'v'"); | ||
process.exit(1); | ||
} | ||
|
||
// Remove the 'v' prefix for the actual version string | ||
const versionNumber = newVersion.slice(1); | ||
|
||
// Find all Cargo.toml files from workspace root | ||
const workspaceRoot = path.resolve(__dirname, ".."); | ||
const cargoFiles = await glob("**/Cargo.toml", { | ||
ignore: ["**/target/**", "**/node_modules/**"], | ||
cwd: workspaceRoot, | ||
absolute: true, | ||
}); | ||
|
||
let success = true; | ||
for (const cargoFile of cargoFiles) { | ||
console.log(`Checking ${cargoFile}...`); | ||
const content = await fs.readFile(cargoFile, "utf8"); | ||
|
||
if (!versionRegex.test(content)) { | ||
console.log(` ℹ️ Skipped, does not contain version field`); | ||
continue; | ||
} | ||
|
||
// Only update the main version field, not dependencies | ||
const updatedContent = content.replace(versionRegex, `version = "${versionNumber}"`); | ||
|
||
if (content === updatedContent) { | ||
const oldVersion = content.match(versionRegex)?.[0]; | ||
console.error(` ❌ Version could not be updated from ${oldVersion} to "${versionNumber}"`); | ||
success = false; | ||
} else { | ||
await fs.writeFile(cargoFile, updatedContent); | ||
console.log(` ✅ Updated version in ${cargoFile} to ${versionNumber}`); | ||
} | ||
} | ||
|
||
if (!success) { | ||
console.error("\n❌ Some versions could not be updated"); | ||
process.exit(1); | ||
} | ||
|
||
// run cargo check | ||
console.log("\nRunning cargo check..."); | ||
const cargoCheck = spawn("cargo", ["check"], { | ||
cwd: workspaceRoot, | ||
stdio: "inherit", | ||
}); | ||
|
||
const exitCode = await new Promise<number>((resolve) => { | ||
cargoCheck.on("close", resolve); | ||
}); | ||
|
||
if (exitCode !== 0) { | ||
process.exit(exitCode); | ||
} | ||
} | ||
|
||
main().catch((err) => { | ||
console.error(err); | ||
process.exit(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters