Skip to content

Commit 6fa0b31

Browse files
fix: make VS Code publish non-blocking in release workflow
- Add continue-on-error to publish-vscode job - Add continue-on-error to individual publish steps - This allows CLI releases to succeed even if VS Code version already exists
1 parent 308a983 commit 6fa0b31

File tree

11 files changed

+577
-24
lines changed

11 files changed

+577
-24
lines changed

.github/workflows/release.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,8 @@ jobs:
202202
needs: [create-release]
203203
runs-on: ubuntu-latest
204204
if: startsWith(github.ref, 'refs/tags/v')
205+
# Continue even if this job fails
206+
continue-on-error: true
205207

206208
steps:
207209
- name: Download VSCode extension
@@ -214,20 +216,22 @@ jobs:
214216
run: npm install -g vsce
215217

216218
- name: Publish to VS Code marketplace
219+
continue-on-error: true
217220
run: |
218221
if [ -n "${{ secrets.VSCE_TOKEN }}" ]; then
219222
echo "Publishing to VS Code marketplace..."
220-
vsce publish --packagePath *.vsix --pat ${{ secrets.VSCE_TOKEN }}
223+
vsce publish --packagePath *.vsix --pat ${{ secrets.VSCE_TOKEN }} || echo "⚠️ Failed to publish to VS Code marketplace (possibly already exists)"
221224
else
222225
echo "⚠️ VSCE_TOKEN not set, skipping VS Code marketplace publish."
223226
fi
224227
225228
- name: Publish to Open VSX Registry
229+
continue-on-error: true
226230
run: |
227231
if [ -n "${{ secrets.OVSX_TOKEN }}" ]; then
228232
echo "Publishing to Open VSX Registry..."
229233
npm install -g ovsx
230-
ovsx publish *.vsix -p ${{ secrets.OVSX_TOKEN }}
234+
ovsx publish *.vsix -p ${{ secrets.OVSX_TOKEN }} || echo "⚠️ Failed to publish to Open VSX (possibly already exists)"
231235
else
232236
echo "⚠️ OVSX_TOKEN not set, skipping Open VSX publish."
233237
fi

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ chrono = { version = "0.4", features = ["serde"] }
3636
fuzzy-matcher = "0.3"
3737

3838
# Validation system dependencies
39-
raz-validation = { path = "raz-validation", version = "0.1.4" }
39+
raz-validation = { path = "raz-validation", version = "0.2.1" }
4040

4141
[profile.release]
4242
opt-level = 3

raz-adapters/cli/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "raz-cli"
3-
version = "0.2.0"
3+
version = "0.2.1"
44
edition = "2024"
55
description = "Universal command runner for Rust - Run any Rust file from anywhere with cursor-aware test targeting and override persistence"
66
license = "MIT"
@@ -18,10 +18,10 @@ name = "raz"
1818
path = "src/main.rs"
1919

2020
[dependencies]
21-
raz-common = { path = "../../raz-common", version = "0.2.0" }
22-
raz-core = { path = "../../raz-core", version = "0.2.0" }
23-
raz-config = { path = "../../raz-config", version = "0.2.0" }
24-
raz-override = { path = "../../raz-override", version = "0.2.0" }
21+
raz-common = { path = "../../raz-common", version = "0.2.1" }
22+
raz-core = { path = "../../raz-core", version = "0.2.1" }
23+
raz-config = { path = "../../raz-config", version = "0.2.1" }
24+
raz-override = { path = "../../raz-override", version = "0.2.1" }
2525
clap = { workspace = true }
2626
tokio = { workspace = true }
2727
serde_json = { workspace = true }

raz-adapters/cli/src/main.rs

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ enum Commands {
5959
#[command(subcommand)]
6060
cmd: OverrideCommands,
6161
},
62+
/// Update RAZ to the latest version
63+
SelfUpdate {
64+
/// Force update even if already on latest version
65+
#[arg(long)]
66+
force: bool,
67+
},
6268
}
6369

6470
#[derive(Subcommand)]
@@ -194,6 +200,9 @@ async fn run(cli: Cli) -> anyhow::Result<()> {
194200
Commands::Override { cmd } => {
195201
return handle_override_command(&working_dir, cmd);
196202
}
203+
Commands::SelfUpdate { force } => {
204+
return handle_self_update(force).await;
205+
}
197206
}
198207
}
199208

@@ -809,6 +818,130 @@ fn detect_subcommand(file_path: &Path, cursor: Option<Position>) -> String {
809818
}
810819
}
811820

821+
/// Handle self-update command
822+
async fn handle_self_update(force: bool) -> anyhow::Result<()> {
823+
use std::process::Stdio;
824+
825+
println!("{} Checking for updates...", OutputFormatter::info("RAZ"));
826+
827+
// Get current version
828+
let current_version = env!("CARGO_PKG_VERSION");
829+
println!("{} Current version: v{}", OutputFormatter::label("Info"), current_version);
830+
831+
// Check if running from cargo install or system PATH
832+
let current_exe = env::current_exe()?;
833+
let exe_dir = current_exe.parent().unwrap();
834+
835+
// Check if we're in a cargo bin directory
836+
let is_cargo_installed = exe_dir.to_string_lossy().contains(".cargo/bin") ||
837+
exe_dir.to_string_lossy().contains(".cargo\\bin");
838+
839+
if !is_cargo_installed {
840+
// Check if it's in system PATH but not cargo
841+
let which_result = process::Command::new("which")
842+
.arg("raz")
843+
.output();
844+
845+
if let Ok(output) = which_result {
846+
let path = String::from_utf8_lossy(&output.stdout).trim().to_string();
847+
if !path.is_empty() && !path.contains(".cargo") {
848+
println!(
849+
"\n{} RAZ appears to be installed via a package manager or custom installation.",
850+
OutputFormatter::warning("Note")
851+
);
852+
println!(
853+
"Please update using the same method you used to install RAZ."
854+
);
855+
return Ok(());
856+
}
857+
}
858+
}
859+
860+
// Get latest version from GitHub API
861+
let latest_version = get_latest_version().await?;
862+
println!("{} Latest version: {}", OutputFormatter::label("Info"), latest_version);
863+
864+
// Compare versions
865+
if !force && current_version == latest_version.trim_start_matches('v') {
866+
println!(
867+
"\n{} You are already on the latest version!",
868+
OutputFormatter::success("✓")
869+
);
870+
return Ok(());
871+
}
872+
873+
// Prompt for confirmation
874+
if !force {
875+
print!("\nUpdate RAZ from v{} to {}? [Y/n] ", current_version, latest_version);
876+
use std::io::{self, Write};
877+
io::stdout().flush()?;
878+
879+
let mut input = String::new();
880+
io::stdin().read_line(&mut input)?;
881+
let choice = input.trim().to_lowercase();
882+
883+
if choice != "y" && choice != "" {
884+
println!("Update cancelled.");
885+
return Ok(());
886+
}
887+
}
888+
889+
// Perform update using cargo install
890+
println!("\n{} Updating RAZ...", OutputFormatter::info("Installing"));
891+
println!("{} This may take a few minutes...", OutputFormatter::dim("Note"));
892+
893+
let mut cmd = process::Command::new("cargo");
894+
cmd.arg("install")
895+
.arg("raz-cli")
896+
.arg("--force")
897+
.stdout(Stdio::inherit())
898+
.stderr(Stdio::inherit());
899+
900+
let status = cmd.status()?;
901+
902+
if status.success() {
903+
println!(
904+
"\n{} RAZ has been successfully updated to {}!",
905+
OutputFormatter::success("Success"),
906+
latest_version
907+
);
908+
println!(
909+
"{} Run {} to verify the update.",
910+
OutputFormatter::info("Tip"),
911+
OutputFormatter::command("raz --version")
912+
);
913+
} else {
914+
anyhow::bail!("Failed to update RAZ. Please try again or install manually.");
915+
}
916+
917+
Ok(())
918+
}
919+
920+
/// Get latest version from GitHub releases
921+
async fn get_latest_version() -> anyhow::Result<String> {
922+
let url = "https://api.github.com/repos/codeitlikemiley/raz/releases/latest";
923+
924+
// Use a simple HTTPS request
925+
let output = process::Command::new("curl")
926+
.args(&["-s", "-H", "Accept: application/vnd.github.v3+json", url])
927+
.output()?;
928+
929+
if !output.status.success() {
930+
anyhow::bail!("Failed to fetch latest version from GitHub");
931+
}
932+
933+
let response = String::from_utf8(output.stdout)?;
934+
935+
// Parse JSON to get tag_name
936+
let json: serde_json::Value = serde_json::from_str(&response)?;
937+
938+
let tag_name = json["tag_name"]
939+
.as_str()
940+
.ok_or_else(|| anyhow::anyhow!("Failed to parse version from GitHub response"))?;
941+
942+
Ok(tag_name.to_string())
943+
}
944+
812945
/// Initialize configuration for the current project
813946
fn init_config(working_dir: &Path, template: &str, force: bool) -> anyhow::Result<()> {
814947
// Auto-detect project type if using default template

raz-adapters/vscode/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"author": "Uriah Galang <[email protected]>",
66
"icon": "images/raz-logo.gif",
77
"license": "MIT",
8-
"version": "0.2.0",
8+
"version": "0.2.1",
99
"repository": {
1010
"type": "git",
1111
"url": "https://github.com/codeitlikemiley/raz"
@@ -85,6 +85,11 @@
8585
"title": "Setup RAZ Binary",
8686
"category": "RAZ"
8787
},
88+
{
89+
"command": "raz.updateBinary",
90+
"title": "Update RAZ Binary",
91+
"category": "RAZ"
92+
},
8893
{
8994
"command": "raz.toggleBreakpointDetection",
9095
"title": "Toggle Breakpoint Detection",

0 commit comments

Comments
 (0)