forked from magentabusiness/magentabusiness.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.sh
More file actions
executable file
·60 lines (45 loc) · 2.01 KB
/
release.sh
File metadata and controls
executable file
·60 lines (45 loc) · 2.01 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
echo "$(date +"%H:%M") Replacing image urls.. "
extensions=( "*.md" "*.yml" "*.html" "*.liquid" "*.sass" "*.css" "*.js" "*.json" "*.sql" "*.cql")
cleanup_dirs=( "user-guide" "reference" "edge" "lwm2m")
# Detect OS and set sed in-place edit flags
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
SED_OPTS=(-i '')
else
# Linux and others
SED_OPTS=(-i)
fi
for ext in "${extensions[@]}"
do
echo "Replacing the image url in $ext files"
find . -type f -iname "$ext" -not -path "./_site/*" -exec sed "${SED_OPTS[@]}" -e '/https/! s/\/images\//https:\/\/img.thingsboard.io\//g' {} \;
find . -type f -iname "$ext" -not -path "./_site/*" -exec sed "${SED_OPTS[@]}" -e 's/https:\/\/thingsboard.io\/images\//https:\/\/img.thingsboard.io\//g' {} \;
find . -type f -iname "$ext" -not -path "./_site/*" -exec sed "${SED_OPTS[@]}" -e '/https:\/\/img.thingsboard.io\/partners\/map-of-distributors\.svg/ s/https:\/\/img.thingsboard.io\/partners\/map-of-distributors\.svg/\/images\/partners\/map-of-distributors.svg/g' {} \;
done
echo "$(date +"%H:%M") Replacing image urls.. done."
echo "$(date +"%H:%M") Uploading images to s3.."
cd images
aws s3 sync . s3://tb-website-images --size-only --quiet
echo "$(date +"%H:%M") Uploading images to s3.. done."
echo "$(date +"%H:%M") Cleanup images.."
for cleanup_dir in "${cleanup_dirs[@]}"
do
git rm -r $cleanup_dir
done
cd -
git restore blog
git restore --staged images/reference/architecture-in-brief.svg
git restore images/reference/architecture-in-brief.svg
echo "$(date +"%H:%M") Cleanup images.. done."
echo "$(date +"%H:%M") Uploading static resources to s3.."
cd js
aws s3 sync . s3://tb-website-static/js --size-only --quiet
cd -
echo "$(date +"%H:%M") Uploading static to s3.. done."
#echo "$(date +"%H:%M") Update configuration pages for CE:"
# python3 generate_config_pages.py ce ../ce3
#echo "$(date +"%H:%M") Update configuration pages for PE:"
# python3 generate_config_pages.py pe ../pe3
git commit -m "Release script"
echo "$(date +"%H:%M") Please review changes and push."