-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathversion.sh
More file actions
45 lines (35 loc) · 1.06 KB
/
version.sh
File metadata and controls
45 lines (35 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh
set -e
BUILD=$1
BRANCH=$2
VERSION=$(npm pkg get version | tr -d '"')
MAJOR=$(echo "$VERSION" | awk -F '[/.]' '{ print $1 }')
MINOR=$(echo "$VERSION" | awk -F '[/.]' '{ print $2 }')
PATCH=$(echo "$VERSION" | awk -F '[/.-]' '{ print $3 }')
PACKAGEVERSION=$VERSION
TAG=$MAJOR
if (echo "$BRANCH" | grep -q "^release");
then
PACKAGEVERSION="${MAJOR}.${MINOR}.${BUILD}"
elif [ "$BRANCH" = "develop" ] || [ "$BRANCH" = "next" ]
then
PACKAGEVERSION="${MAJOR}.${MINOR}.${PATCH}-next.${BUILD}"
else
PACKAGEVERSION="${MAJOR}.${MINOR}.${PATCH}-beta.${BUILD}"
TAG="beta"
fi
echo "PACKAGEVERSION=$PACKAGEVERSION"
echo "TAG=$TAG"
echo "$PACKAGEVERSION" > foo.txt
echo "$TAG" >> foo.txt
DIRECTORIES="./ ./projects/muziehdesign/forms"
for DIR in $DIRECTORIES; do
if [ -d "$DIR" ]; then
echo "Entering $DIR"
cd "$DIR" || exit # Navigate into the directory
npm version "${PACKAGEVERSION}" --no-commit-hooks --no-git-tag-version
cd - || exit # Return to the previous directory
else
echo "Directory $DIR does not exist. Skipping..."
fi
done