-
Notifications
You must be signed in to change notification settings - Fork 356
/
Copy pathpromote.sh
executable file
·78 lines (70 loc) · 1.84 KB
/
promote.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
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
# Make sure you update the version number when changing this script.
version=2.0
promote=false
packages=(
@patternfly/patternfly
@patternfly/react-charts
@patternfly/react-code-editor
@patternfly/react-core
@patternfly/react-drag-drop
@patternfly/react-icons
@patternfly/react-styles
@patternfly/react-table
@patternfly/react-templates
@patternfly/react-tokens
)
packagesExtensions=(
@patternfly/react-topology
@patternfly/react-virtualized-extension
@patternfly/quickstarts
@patternfly/react-user-feedback
@patternfly/react-console
@patternfly/react-log-viewer
@patternfly/react-catalog-view-extension
@patternfly/react-component-groups
)
prereleaseTag=prerelease
show_help() {
echo "Usage: $(basename $0) [OPTIONS]"
echo "Options:"
echo " -h, --help Display this help message"
echo " -v, -version Display version information"
echo " -e Shows extensions packages prerelease versions"
echo " -p Shows the command to promote to latest tag"
echo " -t Versions are displayed for this tag (default: prerelease)"
# Add more options and descriptions as needed
exit 0
}
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
show_help
fi
if [[ "$1" == "-v" || "$1" == "--version" ]]; then
echo "Version: $version"
exit 0
fi
while getopts ept: flag;
do
case "${flag}" in
e) packages+=(${packagesExtensions[@]});;
p) promote=true;;
t) prereleaseTag=${OPTARG};;
*) show_help;;
esac
done
function getPrereleaseVersion {
local version=$(
npm dist-tag ls $1 |
grep $prereleaseTag: |
sed "s/$prereleaseTag:[[:space:]]*//"
)
echo $version
}
for p in ${packages[@]}; do
version=$(getPrereleaseVersion $p)
if [ "$promote" = true ]; then
echo "npm dist-tag add $p@$version latest"
else # list
echo "\"$p\": \"$version\","
fi
done