chore(release): sync Cargo.lock workspace versions on promote (#784)

Extend sync-tauri-version-from-package.js to align psysonic* crate
version fields in Cargo.lock with package.json. Include the lockfile in
promote and post-release main-bump commits. Fixes drift where lock stayed
on the previous -dev while Cargo.toml already matched the channel bump.
This commit is contained in:
cucadmuh
2026-05-18 21:35:04 +03:00
committed by GitHub
parent f6fe1484a9
commit 99c78d8567
6 changed files with 31 additions and 12 deletions
+1 -1
View File
@@ -75,7 +75,7 @@ jobs:
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add package.json package-lock.json src-tauri/Cargo.toml src-tauri/tauri.conf.json
git add package.json package-lock.json src-tauri/Cargo.toml src-tauri/Cargo.lock src-tauri/tauri.conf.json
if git diff --cached --quiet; then
echo "No version bump changes to commit."
exit 0
@@ -47,7 +47,7 @@ jobs:
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add package.json package-lock.json src-tauri/Cargo.toml src-tauri/tauri.conf.json
git add package.json package-lock.json src-tauri/Cargo.toml src-tauri/Cargo.lock src-tauri/tauri.conf.json
if git diff --cached --quiet; then
echo "No finalization changes to commit."
exit 0
@@ -447,7 +447,7 @@ jobs:
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add package.json package-lock.json src-tauri/Cargo.toml src-tauri/tauri.conf.json
git add package.json package-lock.json src-tauri/Cargo.toml src-tauri/Cargo.lock src-tauri/tauri.conf.json
if git diff --cached --quiet; then
echo "No dev version bump required."
exit 0
@@ -463,4 +463,4 @@ jobs:
--base main \
--head "$BRANCH" \
--title "chore(release): bump main to ${VERSION}" \
--body "Auto-generated after stable release: updates \`package.json\`, \`package-lock.json\`, \`src-tauri/Cargo.toml\`, and \`src-tauri/tauri.conf.json\` to the next development version."
--body "Auto-generated after stable release: updates \`package.json\`, \`package-lock.json\`, \`src-tauri/Cargo.toml\`, \`src-tauri/Cargo.lock\`, and \`src-tauri/tauri.conf.json\` to the next development version."
+1 -1
View File
@@ -21,7 +21,7 @@ Direct push to these branches is not part of normal human workflow. Use PRs and
## 2) Versioning rules (mandatory)
Version is authoritative in `package.json` and `package-lock.json`.
Version is authoritative in `package.json` and `package-lock.json`. Promotion workflows run `scripts/sync-tauri-version-from-package.js`, which also aligns `[workspace.package]` in `src-tauri/Cargo.toml`, `tauri.conf.json`, and the `psysonic*` workspace crate version fields in `src-tauri/Cargo.lock` (local `cargo build` alone does not commit that lock metadata).
- `main` version format: `X.Y.Z-dev`
- `next` version format: `X.Y.Z-rc.N`
+20 -1
View File
@@ -1,6 +1,7 @@
#!/usr/bin/env node
/**
* Align src-tauri/Cargo.toml and src-tauri/tauri.conf.json with package.json "version".
* Align src-tauri/Cargo.toml, src-tauri/tauri.conf.json, and workspace entries in
* src-tauri/Cargo.lock with package.json "version".
* Used after npm version in promote workflows so bundle names match release semver.
*/
const fs = require('fs');
@@ -28,3 +29,21 @@ const conf = JSON.parse(fs.readFileSync(confPath, 'utf8'));
conf.version = version;
fs.writeFileSync(confPath, JSON.stringify(conf, null, 2) + '\n');
console.log(`tauri.conf.json -> ${version}`);
/** @param {string} lockText */
function syncCargoLockWorkspaceVersions(lockText, targetVersion) {
return lockText.replace(
/^(name = "psysonic[^"]*"\nversion = ")[^"]+"/gm,
`$1${targetVersion}"`,
);
}
const lockPath = path.join(root, 'src-tauri', 'Cargo.lock');
let lock = fs.readFileSync(lockPath, 'utf8');
const updatedLock = syncCargoLockWorkspaceVersions(lock, version);
if (updatedLock !== lock) {
fs.writeFileSync(lockPath, updatedLock);
console.log(`Cargo.lock workspace crates -> ${version}`);
} else {
console.log(`Cargo.lock workspace crates already at ${version}`);
}
+6 -6
View File
@@ -3708,7 +3708,7 @@ dependencies = [
[[package]]
name = "psysonic"
version = "1.46.0-dev"
version = "1.47.0-dev"
dependencies = [
"biquad",
"dasp_sample",
@@ -3756,7 +3756,7 @@ dependencies = [
[[package]]
name = "psysonic-analysis"
version = "1.46.0-dev"
version = "1.47.0-dev"
dependencies = [
"ebur128",
"futures-util",
@@ -3773,7 +3773,7 @@ dependencies = [
[[package]]
name = "psysonic-audio"
version = "1.46.0-dev"
version = "1.47.0-dev"
dependencies = [
"biquad",
"dasp_sample",
@@ -3802,7 +3802,7 @@ dependencies = [
[[package]]
name = "psysonic-core"
version = "1.46.0-dev"
version = "1.47.0-dev"
dependencies = [
"libc",
"serde",
@@ -3811,7 +3811,7 @@ dependencies = [
[[package]]
name = "psysonic-integration"
version = "1.46.0-dev"
version = "1.47.0-dev"
dependencies = [
"discord-rich-presence",
"futures-util",
@@ -3828,7 +3828,7 @@ dependencies = [
[[package]]
name = "psysonic-syncfs"
version = "1.46.0-dev"
version = "1.47.0-dev"
dependencies = [
"futures-util",
"id3",