-
Notifications
You must be signed in to change notification settings - Fork 20
/
do_dist.sh
executable file
·53 lines (45 loc) · 1.64 KB
/
do_dist.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
#! /bin/bash -e
#
# To make a release:
# - Update the version in packages.json
# - Run this script
# - Git commit and push
# - Create a new tag on github
# OUTDATED, use github action
exit 1
v1=`egrep version\": package.json`
v2=`egrep version\": package-lock.json | head -1`
if [[ "$v1" != "$v2" ]]; then
echo Version mismatch: $v1 vs $v2
npm i --package-lock-only
fi
npm run build
version=`echo $v1 | sed -E 's/.*"([0-9]\..*)".*/\1/'`
echo "Pushing version ${version}"
# produce https.html
sed -E \
-e '/<head>/a\
<base href="https://s3.amazonaws.com/s3.voneicken.com/flexdash/'$version'/index.html" />' \
<./dist/index.html >./docs/https.html
# produce http.html FIXME: support query string args
cat >./docs/http.html <<EOF
<html lang="en"><head>
<link rel="icon" href="./favicon.ico" />
<meta http-equiv="refresh" content="0; url=http://s3.amazonaws.com/s3.voneicken.com/flexdash/${version}/index.html">
</head><body>
Redirecting to <a href="http://s3.amazonaws.com/s3.voneicken.com/flexdash/${version}/index.html">
http://s3.amazonaws.com/s3.voneicken.com/flexdash/${version}/index.html</a>
</body></html>
EOF
git add ./docs
git commit -m 'publish ${version}'
git push
# # --checksum: determine change based on hash and file size, mod time on S3 is bogus
# # --immutable: don't want to overwrite previous release
# set -x
# OPTS=(--progress --checksum --immutable)
# OPTS=("${OPTS[@]}" --config $HOME/.config/rclone/rclone.conf)
# rclone "${OPTS[@]}" sync dist s3-public:s3.voneicken.com/flexdash/${version}
# set +x
# tar czf flexdash-${version}.tar.gz -C dist .
# rclone "${OPTS[@]}" copy flexdash-${version}.tar.gz s3-public:s3.voneicken.com/flexdash/