-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathupdate_submodules.sh
executable file
·39 lines (28 loc) · 1.2 KB
/
update_submodules.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
# Script to update each of the 4 submodules in the IATI-SSOT repository
#
timestamp=$(date +%s)
for version in 1.04 1.05 2.01 2.02 2.03dev; do
# Checkout to the specified version for the SSOT directory
git checkout version-$version
# Pull the latest code from origin for this version (i.e. Git branch) of the SSOT directory
git pull origin version-$version
# Check out a new branch to get around branch protection
git checkout -b update-submodules-$timestamp-$version
# Loop over each subfolder, pull the latest version and add to staging
for folder in IATI-Codelists IATI-Extra-Documentation IATI-Schemas IATI-Rulesets; do
# Enter the specified folder (which contains the submodule)
cd $folder
# Ensure that we are on the correct branch (i.e. Git branch)
git checkout version-$version
# Pull the latest code from origin for this version (i.e. Git branch)
git pull origin version-$version
# Go back to the SSOT folder
cd ..
# Add the specified folder (which contains the submodule) to staging
git add $folder
done
# Commit updated submodules
git commit -m "Updated submodules (using script) "$version
# Push to the server
git push origin update-submodules-$timestamp-$version
done