Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
DAACDemo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Syed Bilal Raees
DAACDemo
Commits
b09bd72b
Commit
b09bd72b
authored
Apr 04, 2023
by
Waqas Riaz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated increment-version.sh
parent
326b17ae
Pipeline
#4042
passed with stages
in 24 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
6 deletions
+22
-6
increment-version.sh
increment-version.sh
+21
-5
version.txt
version.txt
+1
-1
No files found.
increment-version.sh
View file @
b09bd72b
#!/bin/bash
#!/bin/bash
#
Read the current version number from the version.txt file
#
Extract the version number from VERSION.txt
VERSION
=
$(
cat
version.txt
)
VERSION
=
$(
cat
version.txt
)
echo
"Current version is
${
VERSION
}
"
# Increment the version number
# Use a regular expression to extract the major, minor, and patch numbers
NEW_VERSION
=
$(
echo
$VERSION
|
awk
-F
.
'{$NF = $NF + 1;} 1'
OFS
=
.
|
sed
's/.$//'
)
if
[[
${
VERSION
}
=
~ ^
([
0-9]+
)
\.
([
0-9]+
)
\.
([
0-9]+
)
$
]]
;
then
MAJOR
=
${
BASH_REMATCH
[1]
}
MINOR
=
${
BASH_REMATCH
[2]
}
PATCH
=
${
BASH_REMATCH
[3]
}
else
echo
"Could not extract version number from VERSION.txt"
exit
1
fi
# Increment the patch number by 1
PATCH
=
$((${
PATCH
}
+
1
))
# Construct the new version string
NEW_VERSION
=
"
${
MAJOR
}
.
${
MINOR
}
.
${
PATCH
}
"
echo
"New version is
${
NEW_VERSION
}
"
# Write the new version string back to VERSION.txt
echo
"
${
NEW_VERSION
}
"
>
version.txt
# Update the version.txt file with the new version number
echo
$NEW_VERSION
>
version.txt
\ No newline at end of file
version.txt
View file @
b09bd72b
0.2.
7
0.2.
8
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment