Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Version
Manage
Activity
Members
Plan
Jira
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSS
Utilities
Version
Commits
3957b216
Verified
Commit
3957b216
authored
1 year ago
by
Volker Schukai
Browse files
Options
Downloads
Patches
Plain Diff
feat: new flag exit-code-if-no-bump #4
parent
d5438556
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.idea/runConfigurations/version_auto___git.xml
+1
-1
1 addition, 1 deletion
.idea/runConfigurations/version_auto___git.xml
.idea/version.iml
+1
-0
1 addition, 0 deletions
.idea/version.iml
README.md
+9
-0
9 additions, 0 deletions
README.md
source/commandline.go
+8
-1
8 additions, 1 deletion
source/commandline.go
with
19 additions
and
2 deletions
.idea/runConfigurations/version_auto___git.xml
+
1
−
1
View file @
3957b216
<component
name=
"ProjectRunConfigurationManager"
>
<component
name=
"ProjectRunConfigurationManager"
>
<configuration
default=
"false"
name=
"version auto --git"
type=
"GoApplicationRunConfiguration"
factoryName=
"Go Application"
>
<configuration
default=
"false"
name=
"version auto --git"
type=
"GoApplicationRunConfiguration"
factoryName=
"Go Application"
>
<module
name=
"version"
/>
<module
name=
"version"
/>
<working_directory
value=
"$PROJECT_DIR$"
/>
<working_directory
value=
"$PROJECT_DIR$
/../../alvine/components/alvine.dispatcher
"
/>
<parameters
value=
"auto --git"
/>
<parameters
value=
"auto --git"
/>
<EXTENSION
ID=
"com.fapiko.jetbrains.plugins.better_direnv.runconfigs.GolandRunConfigurationExtension"
>
<EXTENSION
ID=
"com.fapiko.jetbrains.plugins.better_direnv.runconfigs.GolandRunConfigurationExtension"
>
<option
name=
"DIRENV_ENABLED"
value=
"false"
/>
<option
name=
"DIRENV_ENABLED"
value=
"false"
/>
...
...
This diff is collapsed.
Click to expand it.
.idea/version.iml
+
1
−
0
View file @
3957b216
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
<excludeFolder
url=
"file://$MODULE_DIR$/.devenv"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/.devenv"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/.direnv"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/.direnv"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/.task"
/>
</content>
</content>
<orderEntry
type=
"inheritedJdk"
/>
<orderEntry
type=
"inheritedJdk"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
...
...
This diff is collapsed.
Click to expand it.
README.md
+
9
−
0
View file @
3957b216
...
@@ -81,6 +81,15 @@ It is important to note that this feature requires that your commit messages
...
@@ -81,6 +81,15 @@ It is important to note that this feature requires that your commit messages
follow the
[
Conventional Commits
](
https://www.conventionalcommits.org/en/v1.0.0/
)
follow the
[
Conventional Commits
](
https://www.conventionalcommits.org/en/v1.0.0/
)
message format.
message format.
The
`exit-code-if-no-bump`
flag can be used to make the command exit with a non-zero exit.
This is useful for CI/CD pipelines.
```
bash
version auto
--exit-code-if-no-bump
```
In this case, the command will exit with the exit code 1 if no version bump is required.
**Predict**
**Predict**
The
`predict`
command allows you to predict the next version based on the
The
`predict`
command allows you to predict the next version based on the
...
...
This diff is collapsed.
Click to expand it.
source/commandline.go
+
8
−
1
View file @
3957b216
...
@@ -31,6 +31,7 @@ type commandLineOptions struct {
...
@@ -31,6 +31,7 @@ type commandLineOptions struct {
Date
struct
{
Date
struct
{
}
`command:"date" description:"print the current date and time in the format YYYYMMDDHHMMSS"`
}
`command:"date" description:"print the current date and time in the format YYYYMMDDHHMMSS"`
Auto
struct
{
Auto
struct
{
ExitCode
bool
`short:"e" long:"exit-code-if-no-bump" description:"exit code to use if no notable changes are found" default:"0"`
}
`command:"auto" description:"check the git repository and increase the version if necessary. This implies --git"`
}
`command:"auto" description:"check the git repository and increase the version if necessary. This implies --git"`
Predict
struct
{
Predict
struct
{
}
`command:"predict" description:"predict the next version based on the git history. This implies --git"`
}
`command:"predict" description:"predict the next version based on the git history. This implies --git"`
...
@@ -178,7 +179,13 @@ func executeCommand() {
...
@@ -178,7 +179,13 @@ func executeCommand() {
case
OtherCommit
:
case
OtherCommit
:
fmt
.
Println
(
"No notable changes found."
)
fmt
.
Println
(
"No notable changes found."
)
fmt
.
Println
(
"If you want to force a version
\n
increase, use the major, minor
\n
or patch command."
)
fmt
.
Println
(
"If you want to force a version
\n
increase, use the major, minor
\n
or patch command."
)
os
.
Exit
(
0
)
exitCode
:=
0
if
arguments
.
Auto
.
ExitCode
{
exitCode
=
1
}
os
.
Exit
(
exitCode
)
}
}
}
}
...
...
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