-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalpha.sh
More file actions
executable file
·36 lines (28 loc) · 1.37 KB
/
alpha.sh
File metadata and controls
executable file
·36 lines (28 loc) · 1.37 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
latest_version=$(curl -s https://registry.npmjs.com/yolkbot | jq -r '.["dist-tags"].alpha')
current_version=$(jq -r '.version' ./package.json)
if [[ "$current_version" != *"-alpha."* ]]; then
echo "The version provided is not a valid alpha version."
exit 1
fi
new_version=$(echo "$current_version" | awk -F. -v OFS=. '{$NF = $NF + 1; print}')
sed -i '' "s/$current_version/$new_version/g" package.json
current_version=$new_version
if [[ "$latest_version" == *"-alpha."* || "$current_version" == *"-alpha."* ]]; then
latest_version_numeric=$(echo "$latest_version" | sed 's/-alpha\.[0-9]*//')
current_version_numeric=$(echo "$current_version" | sed 's/-alpha\.[0-9]*//')
if [ "$latest_version_numeric" == "$current_version_numeric" ]; then
latest_alpha=$(echo "$latest_version" | sed 's/.*-alpha\.//')
current_alpha=$(echo "$current_version" | sed 's/.*-alpha\.//')
if [ "$current_alpha" -le "$latest_alpha" ]; then
echo "The current alpha version must be greater than the latest published alpha version."
exit 1
fi
fi
fi
if [ "$(printf '%s\n' "$latest_version" "$current_version" | sort -V | head -n1)" != "$latest_version" ]; then
echo "The current version must be greater than the latest published version."
exit 1
fi
node browser/compile.js
npm publish --tag alpha
node --env-file=.env cli/publish/alpha.js