From 9de7ee88edaf76003fabb46a63111bcbe5a0695c Mon Sep 17 00:00:00 2001 From: Jamie Pine Date: Thu, 5 Feb 2026 22:58:11 -0800 Subject: [PATCH] Update versioning across multiple packages and enhance GitHub Actions workflow - Changed versioning from "2.0.0-pre.1" to "2.0.0-alpha.1" in various Cargo.toml files and package.json to reflect a new alpha release. - Added support for ARM64 builds in the GitHub Actions workflow, including a new host configuration and installation of VA-API libraries for the ARM target. - Introduced a new `bump` command in the xtask to facilitate version updates across all relevant files, improving version management. --- .github/workflows/release.yml | 9 ++ Cargo.lock | Bin 333405 -> 333427 bytes apps/cli/Cargo.toml | 2 +- apps/server/Cargo.toml | 2 +- apps/tauri/package.json | 2 +- apps/tauri/sd-tauri-core/Cargo.toml | 2 +- apps/tauri/src-tauri/Cargo.toml | 2 +- apps/tauri/src-tauri/tauri.conf.json | 2 +- core/Cargo.toml | 2 +- docs/overview/history.mdx | 2 +- xtask/src/bump.rs | 206 +++++++++++++++++++++++++++ xtask/src/main.rs | 11 ++ 12 files changed, 234 insertions(+), 8 deletions(-) create mode 100644 xtask/src/bump.rs diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a555b4ba5..3d5d6da41 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -104,6 +104,11 @@ jobs: bundles: deb os: linux arch: x86_64 + - host: blacksmith-8vcpu-ubuntu-2204-arm + target: aarch64-unknown-linux-gnu + bundles: deb + os: linux + arch: aarch64 name: Desktop - Main ${{ matrix.settings.target }} runs-on: ${{ matrix.settings.host }} steps: @@ -128,6 +133,10 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - name: Install VA-API libraries + if: matrix.settings.target == 'aarch64-unknown-linux-gnu' + run: sudo apt-get update && sudo apt-get install -y libva-dev libva-drm2 + - name: Install Apple API key if: ${{ runner.os == 'macOS' }} run: | diff --git a/Cargo.lock b/Cargo.lock index b40e8120149c00637db83f27e78f85a738722229..dc049311f5300f513f78dd57c2838a90bbb81555 100644 GIT binary patch delta 121 zcmcb+M&$Dvk%kt=7N#xC8?4z9a|$vN^`<-KGKx=s;LXgn{i-$d97bf}?LD^4%ej$7 hAPOTqnTwd%b&(9%4m5zr7e%O@X(sb_rkO0!wE!dtC}#iw delta 99 zcmeyoM&#}qk%kt=7N#xC8?0Fhic=1.3.0" diff --git a/apps/tauri/sd-tauri-core/Cargo.toml b/apps/tauri/sd-tauri-core/Cargo.toml index ca4b43676..52f10568a 100644 --- a/apps/tauri/sd-tauri-core/Cargo.toml +++ b/apps/tauri/sd-tauri-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sd-tauri-core" -version = "2.0.0" +version = "2.0.0-alpha.1" edition = "2021" [dependencies] diff --git a/apps/tauri/src-tauri/Cargo.toml b/apps/tauri/src-tauri/Cargo.toml index 10feb0517..09ccd7c31 100644 --- a/apps/tauri/src-tauri/Cargo.toml +++ b/apps/tauri/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "spacedrive" -version = "2.0.0" +version = "2.0.0-alpha.1" edition = "2021" [[bin]] diff --git a/apps/tauri/src-tauri/tauri.conf.json b/apps/tauri/src-tauri/tauri.conf.json index 45317680b..554fefc26 100644 --- a/apps/tauri/src-tauri/tauri.conf.json +++ b/apps/tauri/src-tauri/tauri.conf.json @@ -1,6 +1,6 @@ { "productName": "Spacedrive", - "version": "2.0.0-pre.1", + "version": "2.0.0-alpha.1", "identifier": "com.spacedrive.desktop", "build": { "beforeDevCommand": "bun run dev:with-daemon", diff --git a/core/Cargo.toml b/core/Cargo.toml index 91589e93e..90d4e0d72 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -1,7 +1,7 @@ [package] edition = "2021" name = "sd-core" -version = "2.0.0-pre.1" +version = "2.0.0-alpha.1" autobins = true [features] diff --git a/docs/overview/history.mdx b/docs/overview/history.mdx index 60f0f2507..be70ed926 100644 --- a/docs/overview/history.mdx +++ b/docs/overview/history.mdx @@ -131,7 +131,7 @@ The rewrite wasn't a failure of the team. It was the natural outcome of explorin ## V2 Rewrite (2025) -V2 was rebuilt over 4 months by the founder using AI-accelerated development, systematically addressing every failure from V1. Each architectural decision directly solves a specific problem that made V1 unmaintainable. +V2 has been rebuilt by the founder using AI-accelerated development, systematically addressing every failure from V1. Each architectural decision directly solves a specific problem that made V1 unmaintainable. ### Infrastructure: No More Deprecated Dependencies diff --git a/xtask/src/bump.rs b/xtask/src/bump.rs new file mode 100644 index 000000000..f75522243 --- /dev/null +++ b/xtask/src/bump.rs @@ -0,0 +1,206 @@ +use anyhow::{Context, Result}; +use std::path::{Path, PathBuf}; +use std::process::Command; + +enum FileType { + CargoToml, + Json, +} + +/// All files that contain the Spacedrive product version +fn version_files(root: &Path) -> Vec<(PathBuf, FileType)> { + vec![ + (root.join("core/Cargo.toml"), FileType::CargoToml), + (root.join("apps/server/Cargo.toml"), FileType::CargoToml), + (root.join("apps/cli/Cargo.toml"), FileType::CargoToml), + ( + root.join("apps/tauri/src-tauri/Cargo.toml"), + FileType::CargoToml, + ), + ( + root.join("apps/tauri/sd-tauri-core/Cargo.toml"), + FileType::CargoToml, + ), + ( + root.join("apps/tauri/src-tauri/tauri.conf.json"), + FileType::Json, + ), + (root.join("apps/tauri/package.json"), FileType::Json), + ] +} + +fn validate_version(version: &str) -> Result<()> { + let core = version.split('-').next().unwrap_or(version); + + let parts: Vec<&str> = core.split('.').collect(); + if parts.len() != 3 { + anyhow::bail!( + "Invalid version: '{}'. Expected format: X.Y.Z or X.Y.Z-pre.N", + version + ); + } + + for part in &parts { + part.parse::() + .context(format!("Invalid version number: '{}'", part))?; + } + + Ok(()) +} + +fn update_cargo_toml(content: &str, new_version: &str) -> Result<(String, String)> { + let mut lines: Vec = content.lines().map(|l| l.to_string()).collect(); + let mut old_version = String::new(); + let mut in_package = false; + let mut found = false; + + for line in &mut lines { + let trimmed = line.trim(); + + if trimmed == "[package]" { + in_package = true; + continue; + } + if trimmed.starts_with('[') { + in_package = false; + continue; + } + + if in_package && !found { + if let Some(rest) = trimmed.strip_prefix("version") { + let rest = rest.trim(); + if let Some(rest) = rest.strip_prefix('=') { + let rest = rest.trim(); + if rest.starts_with('"') && rest.ends_with('"') { + old_version = rest[1..rest.len() - 1].to_string(); + *line = line.replace( + &format!("\"{}\"", old_version), + &format!("\"{}\"", new_version), + ); + found = true; + } + } + } + } + } + + if !found { + anyhow::bail!("Could not find version in [package] section"); + } + + let mut result = lines.join("\n"); + if content.ends_with('\n') { + result.push('\n'); + } + + Ok((result, old_version)) +} + +fn update_json(content: &str, new_version: &str) -> Result<(String, String)> { + let mut lines: Vec = content.lines().map(|l| l.to_string()).collect(); + let mut old_version = String::new(); + let mut found = false; + + for line in &mut lines { + let trimmed = line.trim(); + + if !found && trimmed.starts_with("\"version\"") { + if let Some(colon_pos) = trimmed.find(':') { + let after_colon = trimmed[colon_pos + 1..].trim(); + let version_str = after_colon.trim_end_matches(','); + if version_str.starts_with('"') && version_str.ends_with('"') { + old_version = version_str[1..version_str.len() - 1].to_string(); + *line = line.replace( + &format!("\"{}\"", old_version), + &format!("\"{}\"", new_version), + ); + found = true; + } + } + } + } + + if !found { + anyhow::bail!("Could not find \"version\" field"); + } + + let mut result = lines.join("\n"); + if content.ends_with('\n') { + result.push('\n'); + } + + Ok((result, old_version)) +} + +pub fn bump(root: &Path, new_version: &str) -> Result<()> { + validate_version(new_version)?; + + println!("Bumping version to {}...", new_version); + println!(); + + for (path, file_type) in version_files(root) { + let relative = path.strip_prefix(root).unwrap_or(&path); + + if !path.exists() { + println!(" ⚠ {} (not found, skipping)", relative.display()); + continue; + } + + let content = std::fs::read_to_string(&path) + .context(format!("Failed to read {}", relative.display()))?; + + let (new_content, old_version) = match file_type { + FileType::CargoToml => update_cargo_toml(&content, new_version)?, + FileType::Json => update_json(&content, new_version)?, + }; + + if content != new_content { + std::fs::write(&path, &new_content) + .context(format!("Failed to write {}", relative.display()))?; + println!( + " ✓ {} ({} → {})", + relative.display(), + old_version, + new_version + ); + } else { + println!(" - {} (already {})", relative.display(), new_version); + } + } + + // Commit version changes and create git tag + let tag = format!("v{}", new_version); + + let files: Vec = version_files(root) + .into_iter() + .filter(|(p, _)| p.exists()) + .map(|(p, _)| p.to_string_lossy().to_string()) + .collect(); + + let mut add_args = vec!["add".to_string()]; + add_args.extend(files); + + Command::new("git") + .args(&add_args) + .current_dir(root) + .status() + .context("Failed to stage version files")?; + + Command::new("git") + .args(["commit", "-m", &tag]) + .current_dir(root) + .status() + .context("Failed to create commit")?; + + Command::new("git") + .args(["tag", &tag]) + .current_dir(root) + .status() + .context("Failed to create tag")?; + + println!(); + println!("Committed and tagged {}. Push with:", tag); + println!(" git push --tags"); + + Ok(()) +} diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 243582829..c4e5d0b3f 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -24,6 +24,7 @@ //! - Cross-platform by default //! - No external tools required (except cargo/rustup) +mod bump; mod config; mod native_deps; mod system; @@ -67,6 +68,7 @@ fn main() -> Result<()> { eprintln!(" build-ios Build sd-ios-core XCFramework for iOS devices and simulator"); eprintln!(" build-mobile Build sd-mobile-core for React Native iOS/Android"); eprintln!(" test-core Run all core integration tests with progress tracking"); + eprintln!(" bump Bump version across all packages (e.g. bump 2.0.0-alpha.2)"); eprintln!(); eprintln!("Examples:"); eprintln!(" cargo xtask setup # First time setup"); @@ -88,6 +90,15 @@ fn main() -> Result<()> { .unwrap_or(false); test_core_command(verbose)?; } + "bump" => { + let version = args.get(2).cloned().unwrap_or_else(|| { + eprintln!("Usage: cargo xtask bump "); + eprintln!("Example: cargo xtask bump 2.0.0-alpha.2"); + std::process::exit(1); + }); + let root = find_workspace_root()?; + bump::bump(&root, &version)?; + } _ => { eprintln!("Unknown command: {}", args[1]); eprintln!("Run 'cargo xtask' for usage information.");