From 6fae5485a7a6625002430b64985754ca87980854 Mon Sep 17 00:00:00 2001 From: Evan Ye Date: Sun, 10 Nov 2024 17:43:13 +0800 Subject: [PATCH] update release --- .github/workflows/release.yml | 1 - .github/workflows/version.js | 41 ----------------------------------- 2 files changed, 42 deletions(-) delete mode 100644 .github/workflows/version.js diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0fceeb4..931fc8b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -116,7 +116,6 @@ jobs: id: changesets uses: changesets/action@v1 with: - version: node .github/workflows/version.js publish: | pnpm publish -r cargo publish diff --git a/.github/workflows/version.js b/.github/workflows/version.js deleted file mode 100644 index af31325..0000000 --- a/.github/workflows/version.js +++ /dev/null @@ -1,41 +0,0 @@ -import fs from 'fs'; -import { exec } from 'child_process'; - -// read changesets version info -async function getNewVersion() { - return new Promise((resolve, reject) => { - exec('node_modules/.bin/changeset status', (error, stdout) => { - if (error) { - reject(error); - return; - } - - const versionMatch = stdout.match(/Version: (.+)/); - if (versionMatch) { - resolve(versionMatch[1].trim()); - } else { - resolve(null); - } - }); - }); -} - -async function main() { - const newVersion = await getNewVersion(); - if (!newVersion) return; - - // read Cargo.toml - const cargoPath = './Cargo.toml'; - let cargoContent = fs.readFileSync(cargoPath, 'utf8'); - - // update version - cargoContent = cargoContent.replace( - /version = "(.*?)"/, - `version = "${newVersion}"` - ); - - // write back to file - fs.writeFileSync(cargoPath, cargoContent); -} - -main().catch(console.error);