Skip to content
Snippets Groups Projects
Commit 8ac344ac authored by poka's avatar poka
Browse files

enh: fetch local tags before check if release already exist

parent 91bc5fa6
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,12 @@ pub async fn handle_command() -> Result<(), GcliError> {
// Step 1: Get actual version of gcli
const VERSION: &str = env!("CARGO_PKG_VERSION");
// Fetch the latest tags from the remote repository
Command::new("git")
.args(["fetch", "--tags"])
.status()
.map_err(|e| anyhow!(e))?;
// Step 2: Check if the git tag already exists
let tag_check_output = Command::new("git").args(["tag", "-l", VERSION]).output()?;
......@@ -28,6 +34,7 @@ pub async fn handle_command() -> Result<(), GcliError> {
Ok(true) => {
// User confirmed, proceed publishing
// Step 3: Create and push the git tag
Command::new("git")
.args(["tag", "-a", VERSION, "-m", &format!("Release v{VERSION}")])
.status()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment