You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/07/09 15:42:00 UTC
[GitHub] houshengbo closed pull request #220: Add script to package the
documents
houshengbo closed pull request #220: Add script to package the documents
URL: https://github.com/apache/incubator-openwhisk-release/pull/220
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/docs/package_artifacts.md b/docs/package_artifacts.md
index c9db792..1c101e0 100644
--- a/docs/package_artifacts.md
+++ b/docs/package_artifacts.md
@@ -41,5 +41,13 @@ After downloading the source code, we can run the following script under _tools_
```
$ ./package_source_code.sh
```
-This script will create a source code package file of source code suffixed with tar.gz for each project, under <local_release_dir>/openwhisk_sources/openwhisk/openwhisk-\<version\>.
+This script will create a source code package file of source code suffixed with tar.gz for each project, under <local_release_dir>/openwhisk_sources/openwhisk/apache-openwhisk-\<version\>.
The key version is defined in _config.json_.
+
+## Adding or updating the documents
+
+We can run the following script under _tools_ to add or update the documents for the current release:
+```
+$ ./package_doc.sh
+```
+This script will copy all the files under releases/<current version> into the designated directory, <local_release_dir>/openwhisk_sources/openwhisk/apache-openwhisk-\<version\>/doc/.
diff --git a/tools/config.json b/tools/config.json
index cfefb2d..84c8bd6 100644
--- a/tools/config.json
+++ b/tools/config.json
@@ -1,5 +1,6 @@
{
- "publish_stage": "true",
+ "publish_stage": "false",
+ "update_doc": "true",
"stage_url": "https://dist.apache.org/repos/dist/dev/incubator/openwhisk",
"release_url": "https://dist.apache.org/repos/dist/release/incubator/openwhisk",
"versioning": {
diff --git a/tools/load_config.sh b/tools/load_config.sh
index 88eed58..b18b628 100755
--- a/tools/load_config.sh
+++ b/tools/load_config.sh
@@ -41,6 +41,7 @@ OPENWHISK_SVN="$OPENWHISK_RELEASE_DIR/openwhisk"
OPENWHISK_PROJECT_NAME="apache-openwhisk"
PUBLISH_STAGE=$(json_by_key "$CONFIG" "publish_stage")
+UPDATE_DOC=$(json_by_key "$CONFIG" "update_doc")
repos=$(echo $(json_by_key "$CONFIG" "RepoList") | sed 's/[][]//g')
STAGE_URL=$(json_by_key "$CONFIG" "stage_url")
RELEASE_URL=$(json_by_key "$CONFIG" "release_url")
diff --git a/tools/package_doc.sh b/tools/package_doc.sh
new file mode 100755
index 0000000..f14f129
--- /dev/null
+++ b/tools/package_doc.sh
@@ -0,0 +1,31 @@
+#!/usr/bin/env 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.
+#
+
+set -e
+
+echo "Package the documents."
+
+SCRIPTDIR="$(cd $(dirname "$0")/ && pwd)"
+source "$SCRIPTDIR/load_config.sh" $1 $2 $3
+
+mkdir -p $CURRENT_VERSION_DIR
+
+# Copy the documents for the current release into the $CURRENT_VERSION_DIR directory
+PARENTDIR="$(dirname "$SCRIPTDIR")"
+mkdir -p ${CURRENT_VERSION_DIR}/doc
+cp $PARENTDIR/releases/$version/* ${CURRENT_VERSION_DIR}/doc/
diff --git a/tools/package_source_code.sh b/tools/package_source_code.sh
index 33ce04b..0f36027 100755
--- a/tools/package_source_code.sh
+++ b/tools/package_source_code.sh
@@ -42,8 +42,3 @@ do
mv $project_name $project_name-$version
tar czf ${CURRENT_VERSION_DIR}/${repo_name}-${version}-sources.tar.gz $project_name-$version
done
-
-# Copy the documents for the current release into the $CURRENT_VERSION_DIR directory
-PARENTDIR="$(dirname "$SCRIPTDIR")"
-mkdir -p ${CURRENT_VERSION_DIR}/doc
-cp $PARENTDIR/releases/$version/* ${CURRENT_VERSION_DIR}/doc/
diff --git a/tools/travis/package_project.sh b/tools/travis/package_project.sh
index b6ac0f6..5323807 100755
--- a/tools/travis/package_project.sh
+++ b/tools/travis/package_project.sh
@@ -31,21 +31,32 @@ if [ ! -z "$TRAVIS_TAG" ] ; then
release_version=$TRAVIS_TAG
source "$PARENTDIR/load_config.sh" "$SVN_USERNAME" "$SVN_PASSWORD" "$PARENTDIR" "$release_version"
"$PARENTDIR/move_stage_to_release.sh" "$SVN_USERNAME" "$SVN_PASSWORD"
-else
+elif [ "$TRAVIS_EVENT_TYPE" == "push" ] ; then
+ # For the Travis builds based on PRs, we only pick the necessary steps based on the flags PUBLISH_STAGE and UPDATE_DOC configured in config.json.
source "$PARENTDIR/load_config.sh" "$SVN_USERNAME" "$SVN_PASSWORD" "$PARENTDIR"
"$PARENTDIR/download_source_code.sh"
- if [ "$TRAVIS_EVENT_TYPE" == "push" ] && [ "$PUBLISH_STAGE" == "true" ] ; then
- "$PARENTDIR/checkout_svn.sh" "$SVN_USERNAME" "$SVN_PASSWORD"
- fi
-
- "$PARENTDIR/package_source_code.sh"
- "$PARENTDIR/package_binaries.sh"
-
- if [ "$TRAVIS_EVENT_TYPE" == "push" ] && [ "$PUBLISH_STAGE" == "true" ] ; then
+ "$PARENTDIR/checkout_svn.sh" "$SVN_USERNAME" "$SVN_PASSWORD"
+ if [ "$PUBLISH_STAGE" == "true" ] ; then
+ "$PARENTDIR/package_source_code.sh"
+ if [ "$UPDATE_DOC" == "true" ] ; then
+ "$PARENTDIR/package_doc.sh"
+ fi
+ "$PARENTDIR/package_binaries.sh"
"$CURRENTDIR/import_pgp_key.sh"
"$PARENTDIR/sign_artifacts.sh"
"$PARENTDIR/upload_artifacts.sh" "$SVN_USERNAME" "$SVN_PASSWORD"
+ "$PARENTDIR/verify_source_code.sh"
+ elif [ "$UPDATE_DOC" == "true" ] ; then
+ "$PARENTDIR/package_doc.sh"
+ "$PARENTDIR/upload_artifacts.sh" "$SVN_USERNAME" "$SVN_PASSWORD"
+ "$PARENTDIR/verify_source_code.sh"
fi
-
+elif [ "$TRAVIS_EVENT_TYPE" == "pull_request" ] ; then
+ # For the Travis builds based on PRs, we need to verify all the steps, expect importing credentials, and uploading the artifacts.
+ source "$PARENTDIR/load_config.sh" "$SVN_USERNAME" "$SVN_PASSWORD" "$PARENTDIR"
+ "$PARENTDIR/download_source_code.sh"
+ "$PARENTDIR/package_source_code.sh"
+ "$PARENTDIR/package_doc.sh"
+ "$PARENTDIR/package_binaries.sh"
"$PARENTDIR/verify_source_code.sh"
fi
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services