-
Notifications
You must be signed in to change notification settings - Fork 0
/
raise-all-market-products.sh
executable file
·60 lines (50 loc) · 1.25 KB
/
raise-all-market-products.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
#!/bin/bash
#
# Usage: raise-all-market-products.sh <version>
#
ignored_repos=(
"market"
"demo-projects"
)
if [ -z "$workDir" ]; then
workDir=$(mktemp -d -t projectConvertXXX)
fi
convert_to_version=$1
if [ -z "$convert_to_version" ]; then
echo "Missing target version parameter e.g 9.4.0-SNAPSHOT"
exit 1
fi
if [[ ! $convert_to_version == *-SNAPSHOT ]]; then
echo "Version must be SNAPSHOT e.g 9.4.0-SNAPSHOT"
exit 1
fi
collectRepos() {
# get repos that are not archived, templates and language is not null
curl https://api.github.com/orgs/axonivy-market/repos?per_page=100 |
jq -r '.[] | select(.archived == false) | select(.is_template == false) | select(.default_branch == master) | select(.language != null) | .name'
}
migrateListOfRepos() {
collectRepos |
while read repo_name; do
migrateRepo $repo_name
done
if [ -f "${workDir}/migrated-repos.txt" ]; then
echo "Migrated repos:"
cat ${workDir}/migrated-repos.txt
fi
}
migrateRepo() {
repo=$1
if [[ " ${ignored_repos[@]} " =~ " ${repo} " ]]; then
echo "Ignoring repo ${repo}"
else
echo "Migrating $repo to $convert_to_version"
source ./repo-migrator.sh
fi
}
repo_name=$2
if [ -z "$repo_name" ]; then
migrateListOfRepos
else
migrateRepo $repo_name
fi