This is an automated email from the ASF dual-hosted git repository.

joshfischer pushed a commit to branch joshfischer/asf-site
in repository https://gitbox.apache.org/repos/asf/incubator-heron.git


The following commit(s) were added to refs/heads/joshfischer/asf-site by this 
push:
     new 2bd8339  pivoting to use gh token
2bd8339 is described below

commit 2bd8339ec332797e901cb82d9a9dafdf484006bf
Author: Josh Fischer <[email protected]>
AuthorDate: Tue Dec 3 21:05:51 2019 -0600

    pivoting to use gh token
---
 website2/website/scripts/publish_site.sh | 35 ++++++++++++++++++++++----------
 1 file changed, 24 insertions(+), 11 deletions(-)

diff --git a/website2/website/scripts/publish_site.sh 
b/website2/website/scripts/publish_site.sh
index 575b399..b313aba 100755
--- a/website2/website/scripts/publish_site.sh
+++ b/website2/website/scripts/publish_site.sh
@@ -16,21 +16,34 @@
 # specific language governing permissions and limitations
 # under the License.
 
+set -e
+
 ROOT_DIR=$(git rev-parse --show-toplevel)
 WORK_DIR=${ROOT_DIR}/generated-site/content
 ME=`basename $0`
 
-# push all of the results to asf-site branch
-git checkout asf-site
-git clean -f -d
-git pull origin asf-site
+ORIGIN_REPO=$(git remote show origin | grep 'Push  URL' | awk -F// '{print 
$NF}')
+echo "ORIGIN_REPO: $ORIGIN_REPO"
+
+HERON_SITE_TMP=/tmp/heron-site
+(
+
+  cd $ROOT_DIR
+  rm -rf $HERON_SITE_TMP
+  mkdir $HERON_SITE_TMP
+  cd $HERON_SITE_TMP
 
-rm -rf ${ROOT_DIR}/content
-mkdir ${ROOT_DIR}/content
+  git clone "https://$GH_TOKEN@$ORIGIN_REPO"; .
+  git config user.name "Heron Site Updater"
+  git config user.email "[email protected]"
+  git checkout asf-site
 
-cp -a $WORK_DIR/* ${ROOT_DIR}/content
-cp -a ${ROOT_DIR}/.htaccess ${ROOT_DIR}/content
+  # copy the generated dir
+  cp -r $WORK_DIR/* $HERON_SITE_TMP/content
+  cp -a ${ROOT_DIR}/.htaccess ${ROOT_DIR}/content
+  # push all of the results to asf-site branch
+  git add -A .
+  git diff-index --quiet HEAD || (git commit -m "git-site-role commit from 
$ME" && git push -q origin HEAD:asf-site)
+  rm -rf $HERON_SITE_TMP
 
-git add ${ROOT_DIR}/content
-git commit -m "git-site-role commit from $ME"
-git push origin asf-site
+)
\ No newline at end of file

Reply via email to