Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/delete-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,22 @@ jobs:
- uses: actions/checkout@v5
with:
fetch-depth: 0
token: ${{ github.token }}

- uses: dtolnay/rust-toolchain@stable

- name: Validate source ref
env:
REF_NAME: ${{ github.ref_name }}
shell: bash
run: |
set -euo pipefail

if [ "${REF_NAME}" != "master" ]; then
echo "::error::Delete Release must be run from master. Current ref: ${REF_NAME}"
exit 1
fi

- name: Bootstrap github-release
run: |
cargo build --release -p github-release
Expand Down
45 changes: 45 additions & 0 deletions crates/github-release/src/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1530,6 +1530,51 @@ mod tests {
);
}

#[test]
fn rollback_analysis_reuses_remaining_stable_release_when_exact_tag_is_missing() {
let tags = vec![
"v0".to_string(),
"v0.3".to_string(),
"v0.3.0".to_string(),
"v0.4".to_string(),
"v0.4.0-rc.1".to_string(),
"latest".to_string(),
"next".to_string(),
];
let analysis = analyze_floating_tags(&tags, "v", "");

assert_eq!(
analysis.latest_stable.as_ref().expect("latest stable").1,
"v0.3.0"
);
assert_eq!(
analysis.next_preview.as_ref().expect("next preview").1,
"v0.4.0-rc.1"
);
assert_eq!(
stale_stable_floating_tags(&tags, &analysis, "v", ""),
vec!["v0.4".to_string()]
);
}

#[test]
fn expected_stable_floating_tags_drop_removed_minor_line_after_rollback() {
let tags = vec![
"v0".to_string(),
"v0.3".to_string(),
"v0.3.0".to_string(),
"v0.4".to_string(),
"v0.4.0-rc.1".to_string(),
];
let analysis = analyze_floating_tags(&tags, "v", "");
let expected = expected_stable_floating_tags(&analysis, "v", "");

assert_eq!(
expected,
HashSet::from(["v0".to_string(), "v0.3".to_string()])
);
}

#[test]
fn stable_floating_tag_detection_respects_prefix_and_suffix() {
let tags = vec![
Expand Down