Skip to content

Commit

Permalink
Merge pull request #49 from deggja/feat_47
Browse files Browse the repository at this point in the history
feat: added semantic versioning #major
  • Loading branch information
deggja authored Dec 11, 2023
2 parents 71be432 + a39b6e1 commit 358c9bb
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 17 deletions.
43 changes: 28 additions & 15 deletions .github/scripts/bump_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,38 @@
git fetch --tags
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1` 2>/dev/null)

if [ -z "$latest_tag" ]; then
new_tag="0.0.1"
else
# Increment the version
major=$(echo $latest_tag | cut -d. -f1)
minor=$(echo $latest_tag | cut -d. -f2)
patch=$(echo $latest_tag | cut -d. -f3)
if [ $patch -lt 99 ]; then
let patch+=1
else
let minor+=1
patch=0
fi
new_tag="${major}.${minor}.${patch}"
# Initialize variables
major=0
minor=0
patch=0

if [ ! -z "$latest_tag" ]; then
# Parse the current version
IFS='.' read -r major minor patch <<< "${latest_tag}"
fi

# Analyze commit messages since the last tag for versioning
for commit in $(git rev-list $latest_tag..HEAD); do
message=$(git log --format=%B -n 1 $commit)

if [[ $message == *"#major"* ]]; then
let major+=1
minor=0
patch=0
break
elif [[ $message == *"#minor"* ]]; then
let minor+=1
patch=0
elif [[ $message == *"#patch"* ]]; then
let patch+=1
fi
done

new_tag="${major}.${minor}.${patch}"

# Set output for the next steps using environment file
echo "new_tag=$new_tag" >> $GITHUB_ENV

# Create the new tag
git tag $new_tag
git push --tags
git push --tags
2 changes: 1 addition & 1 deletion backend/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/spf13/cobra"
)

const version = "0.0.62"
const version = "0.0.65"

var rootCmd = &cobra.Command{
Use: "netfetch",
Expand Down
2 changes: 1 addition & 1 deletion backend/statik/statik.go

Large diffs are not rendered by default.

0 comments on commit 358c9bb

Please sign in to comment.