Skip to content
This repository was archived by the owner on Aug 15, 2019. It is now read-only.

Commit cdc4bd6

Browse files
authored
Simplify make-website.sh and add publish-website.sh (#178)
* simplify make-website.sh and add publish-website.sh * update
1 parent 64886e9 commit cdc4bd6

File tree

2 files changed

+37
-11
lines changed

2 files changed

+37
-11
lines changed

scripts/make-website.sh

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
# =============================================================================
16+
17+
# Builds the website and stages it for preview on localhost:4000. If all is good
18+
# run ./script/publish-website.sh to deploy it to https://deeplearnjs.org.
19+
1620
TMP_DIR="/tmp/deeplearn-website"
1721

1822
npm run prep
@@ -49,14 +53,6 @@ cp -r demos/homepage/* "$TMP_DIR"
4953
cp "README.md" "$TMP_DIR/_includes/"
5054
rm "$TMP_DIR"/index.ts
5155

52-
git stash
53-
git checkout gh-pages
54-
55-
cp -rf "$TMP_DIR"/* .
56-
57-
git add .
58-
git commit -m "github pages"
59-
60-
git checkout master
61-
rm -f -r "_site/"
62-
git stash pop
56+
echo "Website staged at $TMP_DIR"
57+
pushd $TMP_DIR > /dev/null
58+
bundle exec jekyll serve

scripts/publish-website.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2017 Google Inc. All Rights Reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
# =============================================================================
16+
17+
# Deploys the staged website to https://deeplearnjs.org.
18+
# Before running this script, run ./scripts/make-website.sh which stages the
19+
# website and serves it on localhost:4000 for preview.
20+
21+
TMP_DIR="/tmp/deeplearn-website"
22+
pushd $TMP_DIR > /dev/null
23+
bundle exec jekyll build
24+
pushd $TMP_DIR/_site > /dev/null
25+
gsutil -m rsync -d -r . gs://deeplearnjs.org
26+
gsutil -m setmeta -h "Cache-Control:private" "gs://deeplearnjs.org/**.html"
27+
gsutil -m setmeta -h "Cache-Control:private" "gs://deeplearnjs.org/**.css"
28+
gsutil -m setmeta -h "Cache-Control:private" "gs://deeplearnjs.org/**.js"
29+
popd > /dev/null
30+
popd > /dev/null

0 commit comments

Comments
 (0)