-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommit-release.sh
More file actions
executable file
·54 lines (42 loc) · 1.44 KB
/
Copy pathcommit-release.sh
File metadata and controls
executable file
·54 lines (42 loc) · 1.44 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
46
47
48
49
50
51
52
53
54
#!/bin/bash
# Directories to process
PACKAGES_DIR="./packages"
APPS_DIR="./apps"
process_directory() {
local dir_path="$1"
local dir_name="$2"
for package_dir in "$dir_path"/*/; do
local package_name
local package_file
package_name="$(basename "$package_dir")"
package_file="${package_dir}package.json"
# Check if package has changes
if git status --porcelain "$package_dir" | grep -q .; then
echo "Found changes in $package_name ($dir_name)"
# Extract version from package.json
if [ -f "$package_file" ]; then
local version
version="$(jq -r '.version' "$package_file")"
if [ -n "$version" ]; then
echo "Version found: $version"
git add "$package_dir"
git commit --no-verify -m "build($package_name): release \`v$version\`"
else
echo "ERROR: Could not extract version from $package_name"
fi
else
echo "ERROR: package.json not found in $package_name"
fi
else
echo "No changes in $package_name ($dir_name)"
fi
done
}
main() {
echo "Processing packages directory..."
process_directory "$PACKAGES_DIR" "packages"
echo "Processing apps directory..."
process_directory "$APPS_DIR" "apps"
}
main
echo "Process completed!"