-
Notifications
You must be signed in to change notification settings - Fork 1
/
publish.sh
executable file
·65 lines (49 loc) · 1.62 KB
/
publish.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
58
59
60
61
62
63
64
65
#!/bin/bash
# git clone [email protected]:aa-caid/caid-tools.git
# cd caid-tools
# git tag -> to check latest tag
# ./publish.sh x.y.x
git submodule update --init
if [ -z "$1" ]; then
echo "Error: Pass version number x.x.x as argument!"
exit 1
fi
version=$1
# Start out by creating a branch at the currently checked out commit (typically HEAD of main)
git checkout -b "release-tmp-$version"
# Convert sub-modules to regular git folders
submodules=(
"depi-impl"
"gsn-domain"
"webgme-depi"
)
for submodule in "${submodules[@]}"; do
git rm --cached "$submodule"
rm -rf "$submodule/.git"
git add "$submodule"
done
rm ".gitmodules"
# Read the file containing the list of files to delete (make sure to end with a line-break in the black_list_files.txt)
while read -r file; do
if [ -e "$file" ]; then
echo "Deleting file: $file"
rm "$file"
else
echo "File not found: $file"
fi
done < "black_list_files.txt"
rm "black_list_files.txt"
git add .
git commit -m "converted commit"
# Then set the remote to the public github repo and fetch the last published version (main)
git remote set-url origin [email protected]:vu-isis/CAID-tools.git
git fetch --all
# Create a diff from the new release state with the last published version (main in github)
git diff -R --binary "release-tmp-$version" origin/main > release.diff
# Create temporary branch from that main and apply that diff
git checkout -b "new-release-$version" origin/main
git apply release.diff
git add .
git commit -am "Release ${version}"
# Finally push that new version to the remote
git push -u origin "new-release-$version":main