kou commented on a change in pull request #16: ARROW-6260: [Website] Use deploy 
key on Travis to build and push to asf-site
URL: https://github.com/apache/arrow-site/pull/16#discussion_r316484106
 
 

 ##########
 File path: build-and-deploy.sh
 ##########
 @@ -35,7 +35,18 @@ if [ "${TRAVIS_BRANCH}" = "master" ] && [ 
"${TRAVIS_PULL_REQUEST}" = "false" ];
     JEKYLL_ENV=production bundle exec jekyll build --baseurl="${BASE_URL}"
 
     # Publish
-    git clone -b ${TARGET_BRANCH} 
https://${GITHUB_PAT}@github.com/$TRAVIS_REPO_SLUG.git OUTPUT
+    if [ "${DEPLOY_KEY}" != "" ]; then
+        echo "Setting deploy key"
+        eval $(ssh-agent -s)
+        # Hack to make the key from the env var have real newlines
+        echo "${DEPLOY_KEY}" | sed -e 's/\\n/\
+/g' | ssh-add -
 
 Review comment:
   Can we use `s/\\n/\n/g` here?
   
   It works well with bash on my Debian GNU/Linux:
   
   ```bash
   #!/bin/bash
   
   DEPLOY_KEY="-----BEGIN\ OPENSSH\ PRIVATE\ KEY-----\\naaa\\nbbb"
   echo "${DEPLOY_KEY}"
   echo "${DEPLOY_KEY}" | sed -e 's/\\n/\n/g'
   ```
   
   ```console
   $ /tmp/a.sh
   -----BEGIN\ OPENSSH\ PRIVATE\ KEY-----\naaa\nbbb
   -----BEGIN\ OPENSSH\ PRIVATE\ KEY-----
   aaa
   bbb
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to