This is an automated email from the ASF dual-hosted git repository.
sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/master by this push:
new 809f2cb ISSUE #320: add scripts for publishing new website to staging
and apache
809f2cb is described below
commit 809f2cbf16d9ecb1b04fda23d610deea4c9bfabe
Author: Sijie Guo <[email protected]>
AuthorDate: Fri Jul 28 17:59:48 2017 -0700
ISSUE #320: add scripts for publishing new website to staging and apache
Descriptions of the changes in this PR:
- script for staging changes to a staging-site repo
- steps for how to staging changes for reviews
- script for pushing changes to apache
Author: Sijie Guo <[email protected]>
Reviewers: Luc Perkins <[email protected]>, Matteo Merli
<[email protected]>
This closes #322 from sijie/publish_scripts, closes #320
---
.gitignore | 3 ---
pom.xml | 2 +-
site/.gitignore | 1 +
site/Makefile | 13 ++++++++---
site/README.md | 15 +++++++++++++
site/_config.apache.yml | 2 ++
site/_config.local.yml | 34 -----------------------------
site/_config.staging.yml | 2 ++
site/_config.yml | 5 +++--
site/scripts/common.sh | 8 +++++--
site/scripts/publish-website.sh | 45 ++++++++++++++++++++++++++++++++++++++
site/scripts/staging-website.sh | 48 +++++++++++++++++++++++++++++++++++++++++
12 files changed, 133 insertions(+), 45 deletions(-)
diff --git a/.gitignore b/.gitignore
index ba3181e..15ad27f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,6 +20,3 @@ lib/
log/
target/
dependency-reduced-pom.xml
-
-# Generated website
-docs/
diff --git a/pom.xml b/pom.xml
index 854a7ef..8e78dd9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -163,7 +163,7 @@
<version>${maven-javadoc-plugin.version}</version>
<configuration>
<!-- Prevent missing javadoc comments from being marked as errors -->
- <additionalparam>-Xdoclint:none</additionalparam>
+ <additionalparam>-Xdoclint:none -notimestamp</additionalparam>
<subpackages>org.apache.bookkeeper.client:org.apache.bookkeeper.common.annotation:org.apache.bookkeeper.conf:org.apache.bookkeeper.feature:org.apache.bookkeeper.stats</subpackages>
<groups>
<group>
diff --git a/site/.gitignore b/site/.gitignore
index 0af9fb1..15a21ca 100644
--- a/site/.gitignore
+++ b/site/.gitignore
@@ -5,3 +5,4 @@ vendor/bundle/
.bundle/
.sass-cache/
local-generated/
+generated_site/
diff --git a/site/Makefile b/site/Makefile
index 8987b13..3719f81 100644
--- a/site/Makefile
+++ b/site/Makefile
@@ -8,7 +8,7 @@ dev:
make serve
clean:
- rm -rf _site
+ rm -rf _site local-generated generated_site
setup:
gem install bundler \
@@ -22,12 +22,19 @@ build: clean
${JEKYLL} build \
--config _config.yml
-javadoc-gen:
+apache: clean
+ ${JEKYLL} build \
+ --config _config.yml,_config.apache.yml
+
+javadoc:
scripts/javadoc-gen.sh
+staging: clean
+ ${JEKYLL} build --config _config.yml,_config.staging.yml
+
serve: build
${JEKYLL} serve \
--incremental \
- --config _config.local.yml
+ --config _config.yml,_config.local.yml
publish: javadoc-gen build
diff --git a/site/README.md b/site/README.md
index 9b2f01f..cd6d4a9 100644
--- a/site/README.md
+++ b/site/README.md
@@ -42,3 +42,18 @@ $ make serve
```
Then navigate to `localhost:4000`. As you make changes, the browser will
auto-update.
+
+## Staging website for reviews
+
+When you submit a pull request for modifying website or documentation, you are
recommended to make your changes live for reviews.
+
+Here are a few steps to follow to stage your changes:
+
+1. You need to create a github repo called `bookkeeper-staging-site` under
your github account. You can fork this [staging
repo](https://github.com/sijie/bookkeeper-staging-site) as well.
+2. In your `bookeeper-staging-site` repo, go to `Settings > GitHub Pages`.
Enable `GitHub Pages` on `master branch /docs folder`.
+3. Make changes to the website, follow the steps above to verify the changes
locally.
+4. Once the changes are verified locally, you can run `make staging`. It will
generate the files under `site/local-generated`.
+5. Run `scripts/staging-website.sh`. It would push the generated website to
your `bookkeeper-staging-site`.
+6. Your changes will be live on
`https://<your-github-id>.github.io/bookkeeper-staging-site`.
+
+If you have any ideas to improve the review process for website, please feel
free to contact us at [email protected].
diff --git a/site/_config.apache.yml b/site/_config.apache.yml
new file mode 100644
index 0000000..7708fd0
--- /dev/null
+++ b/site/_config.apache.yml
@@ -0,0 +1,2 @@
+baseurl: /test/content/
+destination: generated_site/content
diff --git a/site/_config.local.yml b/site/_config.local.yml
index e9290ea..f93cfaa 100644
--- a/site/_config.local.yml
+++ b/site/_config.local.yml
@@ -1,35 +1 @@
-title: Apache BookKeeper
-subtitle: A replicated log service
-github_repo: https://github.com/apache/bookkeeper
-permalink: pretty
-bk_version: "4.5.0"
destination: local-generated
-baseurl: /
-
-livereload: true
-
-defaults:
-- scope:
- path: docs
- values:
- layout: docs
- toc: true
-- scope:
- path: community
- values:
- layout: community
-- scope:
- path: project
- values:
- layout: community
-
-gems:
-- jekyll-toc
-
-exclude:
-- Gemfile
-- Gemfile.lock
-- Makefile
-- vendor/bundle
-- scripts
-- overview
diff --git a/site/_config.staging.yml b/site/_config.staging.yml
new file mode 100644
index 0000000..3846001
--- /dev/null
+++ b/site/_config.staging.yml
@@ -0,0 +1,2 @@
+baseurl: /bookkeeper-staging-site/
+destination: local-generated
diff --git a/site/_config.yml b/site/_config.yml
index 5b9f4d6..048a0bd 100644
--- a/site/_config.yml
+++ b/site/_config.yml
@@ -4,8 +4,8 @@ github_repo: https://github.com/apache/bookkeeper
github_master: https://github.com/apache/bookkeeper/tree/master
permalink: pretty
bk_version: "4.5.0"
-baseurl: /bookkeeper/
-destination: ../docs
+baseurl: /
+destination: local-generated
twitter_url: https://twitter.com/asfbookkeeper
livereload: true
@@ -39,6 +39,7 @@ exclude:
- Makefile
- vendor/bundle
- local-generated
+- generated_site
- scripts
- overview
- README.md
diff --git a/site/scripts/common.sh b/site/scripts/common.sh
index 8ac0859..ae8e9b4 100755
--- a/site/scripts/common.sh
+++ b/site/scripts/common.sh
@@ -1,5 +1,9 @@
#!/bin/bash
ROOT_DIR=$(git rev-parse --show-toplevel)
-JAVADOC_GEN_DIR=target/site/apidocs
-JAVADOC_DEST_DIR=site/javadoc
\ No newline at end of file
+REVISION=$(git rev-parse --short HEAD)
+JAVADOC_GEN_DIR=${JAVADOC_GEN_DIR:-"target/site/apidocs"}
+JAVADOC_DEST_DIR=${JAVADOC_DEST_DIR:-"site/javadoc"}
+LOCAL_GENERATED_DIR=$ROOT_DIR/site/local-generated
+APACHE_GENERATED_DIR=$ROOT_DIR/site/generated_site
+TMP_DIR=/tmp/bookkeeper-site
diff --git a/site/scripts/publish-website.sh b/site/scripts/publish-website.sh
new file mode 100755
index 0000000..18ab9a2
--- /dev/null
+++ b/site/scripts/publish-website.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# NOTE: this is the script used by CI to push to apache. If you are looking for
+# staging the changes, try the `staging-website.sh` script.
+
+source scripts/common.sh
+
+ORIGIN_REPO=$(git remote show origin | grep 'Push URL' | awk -F// '{print
$NF}')
+echo "ORIGIN_REPO: $ORIGIN_REPO"
+
+(
+ cd $APACHE_GENERATED_DIR
+
+ git init
+ git config user.name "Apache BookKeeper Site Updater"
+ git config user.email "[email protected]"
+
+ git remote add upstream "https://$ORIGIN_REPO"
+ git fetch upstream
+ git reset upstream/asf-site
+
+ touch .
+
+ git add -A .
+ git commit -m "Updated site at revision $REVISION"
+ git push -q upstream HEAD:asf-site
+)
diff --git a/site/scripts/staging-website.sh b/site/scripts/staging-website.sh
new file mode 100755
index 0000000..9de1dd2
--- /dev/null
+++ b/site/scripts/staging-website.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+source scripts/common.sh
+
+ORIGIN_REPO=$(git remote show origin | grep 'Push URL' | awk -F// '{print
$NF}')
+echo "ORIGIN_REPO: $ORIGIN_REPO"
+STAGING_REPO=`echo $ORIGIN_REPO | sed -e
's/bookkeeper\.git/bookkeeper-staging-site.git/g'`
+echo "STAGING_REPO: $STAGING_REPO"
+echo "GENERATE SITE DIR: $LOCAL_GENERATED_DIR"
+
+(
+ rm -rf $TMP_DIR
+ mkdir -p $TMP_DIR
+ cp -r $LOCAL_GENERATED_DIR $TMP_DIR/docs
+ cd $TMP_DIR
+
+ git init
+
+ git remote add upstream "https://$STAGING_REPO"
+ git fetch upstream
+ git reset upstream/master
+
+ touch .
+
+ git add -A .
+ git commit -m "Updated site at revision $REVISION"
+ git push -q upstream HEAD:master
+
+ rm -rf $TMP_DIR
+)
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].