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

eolivelli 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 8a780ca  [website] use GH_TOKEN to push to asf-site and asf-staging 
branches (#3124)
8a780ca is described below

commit 8a780caf00e7874053a8cc81e7596f9d92b05a07
Author: Nicolò Boschi <[email protected]>
AuthorDate: Fri Mar 18 09:59:11 2022 +0100

    [website] use GH_TOKEN to push to asf-site and asf-staging branches (#3124)
---
 .github/workflows/website-deploy.yaml         | 1 +
 .github/workflows/website-staging-deploy.yaml | 1 +
 site/scripts/publish-website.sh               | 6 +++---
 site3/website/scripts/publish-website.sh      | 3 +--
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/website-deploy.yaml 
b/.github/workflows/website-deploy.yaml
index ebbd729..b6f9825 100644
--- a/.github/workflows/website-deploy.yaml
+++ b/.github/workflows/website-deploy.yaml
@@ -29,6 +29,7 @@ on:
 jobs:
   build-website:
     name: Build and publish website
+    if: ${{ github.repository == 'apache/bookkeeper' }}
     runs-on: ubuntu-latest
     timeout-minutes: 180
     steps:
diff --git a/.github/workflows/website-staging-deploy.yaml 
b/.github/workflows/website-staging-deploy.yaml
index 3601b3e..92e55be 100644
--- a/.github/workflows/website-staging-deploy.yaml
+++ b/.github/workflows/website-staging-deploy.yaml
@@ -33,6 +33,7 @@ env:
 jobs:
   stage-website:
     name: Build and stage website
+    if: ${{ github.repository == 'apache/bookkeeper' }}
     runs-on: ubuntu-latest
     timeout-minutes: 180
     steps:
diff --git a/site/scripts/publish-website.sh b/site/scripts/publish-website.sh
index 543dad5..2f6b3c6 100755
--- a/site/scripts/publish-website.sh
+++ b/site/scripts/publish-website.sh
@@ -21,6 +21,8 @@
 # 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
@@ -30,11 +32,9 @@ source scripts/common.sh
   cd $TMP_DIR
 
   # clone the remote repo
-  # Workaround: 
https://stackoverflow.com/questions/22147574/fatal-could-not-read-username-for-https-github-com-no-such-file-or-directo
-  git clone "[email protected]:apache/bookkeeper.git" .
+  git clone --depth 1 -b asf-site "https://$GH_TOKEN@$ORIGIN_REPO"; .
   git config user.name "Apache BookKeeper Site Updater"
   git config user.email "[email protected]"
-  git checkout asf-site
   # copy the apache generated dir
   cp -r $APACHE_GENERATED_DIR/content/* $TMP_DIR/content
 
diff --git a/site3/website/scripts/publish-website.sh 
b/site3/website/scripts/publish-website.sh
index 54826d6..aeada43 100755
--- a/site3/website/scripts/publish-website.sh
+++ b/site3/website/scripts/publish-website.sh
@@ -32,10 +32,9 @@ TMP_DIR=/tmp/bookkeeper-site
   cd $TMP_DIR
 
   # clone the remote repo
-  git clone "https://$ORIGIN_REPO"; .
+  git clone --depth 1 -b asf-staging "https://$GH_TOKEN@$ORIGIN_REPO"; .
   git config user.name "Apache BookKeeper Site Updater"
   git config user.email "[email protected]"
-  git checkout asf-staging
   # copy the apache generated dir
   mkdir -p content
   cp -r $ROOT_DIR/site3/website/build/* content

Reply via email to