Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Ğ
Ğcli-v2s
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Fabrice LEBON
Ğcli-v2s
Commits
8ac344ac
Commit
8ac344ac
authored
1 year ago
by
poka
Browse files
Options
Downloads
Patches
Plain Diff
enh: fetch local tags before check if release already exist
parent
91bc5fa6
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/commands/publish.rs
+7
-0
7 additions, 0 deletions
src/commands/publish.rs
with
7 additions
and
0 deletions
src/commands/publish.rs
+
7
−
0
View file @
8ac344ac
...
@@ -11,6 +11,12 @@ pub async fn handle_command() -> Result<(), GcliError> {
...
@@ -11,6 +11,12 @@ pub async fn handle_command() -> Result<(), GcliError> {
// Step 1: Get actual version of gcli
// Step 1: Get actual version of gcli
const
VERSION
:
&
str
=
env!
(
"CARGO_PKG_VERSION"
);
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
// Step 2: Check if the git tag already exists
let
tag_check_output
=
Command
::
new
(
"git"
)
.args
([
"tag"
,
"-l"
,
VERSION
])
.output
()
?
;
let
tag_check_output
=
Command
::
new
(
"git"
)
.args
([
"tag"
,
"-l"
,
VERSION
])
.output
()
?
;
...
@@ -28,6 +34,7 @@ pub async fn handle_command() -> Result<(), GcliError> {
...
@@ -28,6 +34,7 @@ pub async fn handle_command() -> Result<(), GcliError> {
Ok
(
true
)
=>
{
Ok
(
true
)
=>
{
// User confirmed, proceed publishing
// User confirmed, proceed publishing
// Step 3: Create and push the git tag
// Step 3: Create and push the git tag
Command
::
new
(
"git"
)
Command
::
new
(
"git"
)
.args
([
"tag"
,
"-a"
,
VERSION
,
"-m"
,
&
format!
(
"Release v{VERSION}"
)])
.args
([
"tag"
,
"-a"
,
VERSION
,
"-m"
,
&
format!
(
"Release v{VERSION}"
)])
.status
()
.status
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment