-
-
Notifications
You must be signed in to change notification settings - Fork 302
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Dengfeng Liu <[email protected]>
- Loading branch information
Showing
2 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
# Check if a command line argument is provided | ||
if [ $# -eq 0 ] | ||
then | ||
echo "No arguments supplied. Please provide the major version." | ||
exit 1 | ||
fi | ||
|
||
# Get the major version from the command line argument | ||
major_version=$1 | ||
|
||
# Get the current branch's commit count | ||
commit_count=$(git rev-list --count HEAD) | ||
|
||
# Get the current month | ||
current_month=$(date +%m) | ||
|
||
# Define the version | ||
version="${major_version}.${current_month}.${commit_count}" | ||
|
||
# Create the version.h file | ||
cat << EOF > src/version.h | ||
#ifndef _VERSION_ | ||
#define _VERSION_ | ||
#define VERSION "${version}" | ||
#endif | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#ifndef _VERSION_ | ||
#define _VERSION_ | ||
#define VERSION "7.02.1977" | ||
#define VERSION "7.06.2008" | ||
#endif |