Skip to content

Commit

Permalink
adjusted directory structure & scripts fo a more clean repo (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
noMoreCLI authored Dec 10, 2024
1 parent a44d4a5 commit 21baa05
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
7 changes: 4 additions & 3 deletions build.sh → scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

# Default values for parameters
PUSH=
REPO_DIR=$(dirname $0)/..
#MacOSX M architecture: linux/arm64/v8
PLATFORM="linux/amd64"
IMAGE_PREFIX="app-simulator"
VERSION=$(./bumpversion.sh)
VERSION=$($REPO_DIR/scripts/bumpversion.sh)

# Function to display help
show_help() {
Expand Down Expand Up @@ -45,7 +46,7 @@ for ARG in "$@"; do
esac
done

for DIR in services/*;
for DIR in $REPO_DIR/src/services/*;
do
if [ -d $DIR ] ; then
IMAGE_TAG="${IMAGE_PREFIX}/services-$(basename "$DIR"):$VERSION"
Expand All @@ -55,7 +56,7 @@ do
fi
done;

for DIR in loaders/*;
for DIR in $REPO_DIR/src/loaders/*;
do
if [ -d $DIR ] ; then
IMAGE_TAG="${IMAGE_PREFIX}/loaders-$(basename "$DIR"):$VERSION"
Expand Down
25 changes: 13 additions & 12 deletions bumpversion.sh → scripts/bumpversion.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
#!/bin/bash

# File that stores the version string
VERSION_FILE=".version"
REPO_DIR=$(dirname $0)/..
VERSION_FILE="$REPO_DIR/.version"

# Function to display help
show_help() {
echo "Usage: bumpversion.sh [OPTION]"
echo "Modify or display the version string in the form of 'v{major}.{minor}.{build}'."
echo "Modify or display the version string in the form of 'v{major}.{minor}.{patch}'."
echo "Stores the version in the file '$VERSION_FILE', defaults to v0.0.0 if it does not exist"
echo
echo "Options:"
echo " --build Increase the build number by 1."
echo " --minor Increase the minor number by 1 and the build number by 1."
echo " --major Increase the major number by 1, reset minor to 0, and increase build by 1."
echo " --patch Increase the patch number by 1."
echo " --minor Increase the minor number by 1 and reset patch to 0."
echo " --major Increase the major number by 1, reset minor to 0, reset patch to 0."
echo " --help Display this help message."
echo " (no option) Display the current version."
}
Expand All @@ -34,30 +35,30 @@ set_version() {
# Get the current version
current_version=$(get_version)

# Extract major, minor, and build numbers
# Extract major, minor, and patch numbers
version_pattern='^v([0-9]+)\.([0-9]+)\.([0-9]+)$'
if [[ $current_version =~ $version_pattern ]]; then
major=${BASH_REMATCH[1]}
minor=${BASH_REMATCH[2]}
build=${BASH_REMATCH[3]}
patch=${BASH_REMATCH[3]}
else
echo "Invalid version format"
exit 1
fi

# Handle command-line arguments
case "$1" in
--build)
((build++))
--patch)
((patch++))
;;
--minor)
((minor++))
((build++))
patch=0
;;
--major)
((major++))
minor=0
((build++))
patch=0
;;
--help)
show_help
Expand All @@ -71,7 +72,7 @@ case "$1" in
esac

# Construct the new version string
new_version="v${major}.${minor}.${build}"
new_version="v${major}.${minor}.${patch}"

# Update the version file
set_version "$new_version"
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 21baa05

Please sign in to comment.