-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.sh
57 lines (50 loc) · 1.39 KB
/
build.sh
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
46
47
48
49
50
51
52
53
54
55
56
57
# Description: Build all the javascript projects in the repository
projects_with_package=()
projects_with_action=()
for dir in */; do
# Ignore the docs directory
if [ "$dir" == "docs/" ]; then
continue
fi
if [ -f "$dir/package.json" ]; then
projects_with_package+=("$dir")
elif [ -f "$dir/action.yml" ]; then
projects_with_action+=("$dir")
fi
done
project_to_build=$1
if [ -n "$project_to_build" ]; then
echo "Building specified project: $project_to_build"
project_found=false
for project in "${projects_with_package[@]}"; do
if [[ $project == "$project_to_build/" ]]; then
project_found=true
cd "$project_to_build" || exit
echo "==== Building $project_to_build ===="
npm install
npm run all
cd ..
break
fi
done
if [ "$project_found" = false ]; then
echo "Project $project_to_build not found or does not have a package.json"
exit 1
fi
else
echo "==== Composite actions ===="
for project in "${projects_with_action[@]}"; do
echo "$project"
done
echo "Javascript projects:"
for project in "${projects_with_package[@]}"; do
(
cd "$project" || exit
echo "==== Building $project ===="
npm install
npm run all
cd ..
) &
done
wait
fi