Skip to content

Commit 96af984

Browse files
committed
fix(self_update): use semver version comparison
1 parent 9d739e3 commit 96af984

File tree

5 files changed

+22
-14
lines changed

5 files changed

+22
-14
lines changed

.github/workflows/release-plz.yml

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ jobs:
99
release-plz-release:
1010
name: Release-plz release
1111
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
1214
steps:
1315
- name: Checkout repository
1416
uses: actions/checkout@v4

.release-plz.toml

-12
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,6 @@ body = """
5959
{% endif -%}
6060
{% endfor -%}
6161
{% endfor -%}
62-
{%- if remote.contributors %}
63-
### Contributors
64-
{% for contributor in remote.contributors %}
65-
* @{{ contributor.username }}
66-
{%- endfor %}
67-
{% endif -%}
68-
{%- macro username(commit) -%}
69-
{% if commit.remote.username %} (by @{{ commit.remote.username }}){% endif -%}
70-
{% endmacro -%}
71-
{%- macro pr(commit) -%}
72-
{% if commit.remote.pr_number %} - #{{ commit.remote.pr_number }}{% endif -%}
73-
{% endmacro -%}
7462
"""
7563
trim = true
7664
commit_parsers = [

Cargo.lock

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

soar-cli/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ rayon = { workspace = true }
2727
regex = { workspace = true }
2828
reqwest = { workspace = true }
2929
rusqlite = { workspace = true }
30+
semver = "1.0.25"
3031
serde = { workspace = true }
3132
serde_json = { workspace = true }
3233
soar-core = { version = "0.1.10", path = "../soar-core" }

soar-cli/src/self_actions.rs

+12-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use std::{
33
fs,
44
};
55

6+
use semver::Version;
67
use soar_core::{error::ErrorContext, SoarResult};
78
use soar_dl::{
89
downloader::{DownloadOptions, Downloader},
@@ -38,8 +39,17 @@ pub async fn process_self_action(action: &SelfAction) -> SoarResult<()> {
3839
if target_nightly {
3940
is_nightly_release && rel.name() != self_version
4041
} else {
41-
!is_nightly_release
42-
&& (is_nightly || rel.tag_name().trim_start_matches("v") > self_version)
42+
let release_version = rel.tag_name().trim_start_matches("v");
43+
44+
let release_version = Version::parse(release_version).ok();
45+
let self_version = Version::parse(self_version).ok();
46+
47+
match (release_version, self_version) {
48+
(Some(release_ver), Some(self_ver)) => {
49+
!is_nightly_release && (is_nightly || release_ver > self_ver)
50+
}
51+
_ => false,
52+
}
4353
}
4454
});
4555

0 commit comments

Comments
 (0)