You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ko...@apache.org on 2019/09/18 01:22:31 UTC

[arrow-site] branch master updated: [GitHub Actions] Fix push target

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

kou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-site.git


The following commit(s) were added to refs/heads/master by this push:
     new ccdb39a  [GitHub Actions] Fix push target
ccdb39a is described below

commit ccdb39a0e32802bbb6c94961ac5f4deea730a932
Author: Sutou Kouhei <ko...@clear-code.com>
AuthorDate: Wed Sep 18 09:49:46 2019 +0900

    [GitHub Actions] Fix push target
---
 .github/workflows/deploy.yml | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index 9166fe8..c2e0fd8 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -33,15 +33,21 @@ jobs:
       - name: Install dependencies
         run: |
           bundle install
+      - name: Configure for production
+        run: |
+          echo "BASE_URL=" >> ../env.sh
+          echo "ORIGIN=$(jq .repository.full_name ${GITHUB_EVENT_PATH})" >> ../env.sh
+          echo "TARGET_BRANCH=asf-site" >> ../env.sh
+        if: github.event_name == 'push'
+      - name: Configure for GitHub Pages
+        run: |
+          echo "BASE_URL=$(jq .pull_request.head.repo.name ${GITHUB_EVENT_PATH})" >> ../env.sh
+          echo "ORIGIN=$(jq .pull_request.head.repo.full_name ${GITHUB_EVENT_PATH})" >> ../env.sh
+          echo "TARGET_BRANCH=gh-pages" >> ../env.sh
+        if: github.event_name == 'pull_request'
       - name: Build
         run: |
-          if [ "${GITHUB_REPOSITORY}" = "apache/arrow-site" ]; then
-            # Production
-            BASE_URL=
-          else
-            # On a fork, so we'll deploy to GitHub Pages
-            BASE_URL=$(echo ${GITHUB_REPOSITORY} | sed -e 's@.*/@/@')
-          fi
+          . ../env.sh
           JEKYLL_ENV=production \
             bundle exec \
               jekyll build \
@@ -49,17 +55,11 @@ jobs:
                 --destination=../build
       - name: Deploy
         run: |
-          if [ "${GITHUB_REPOSITORY}" = "apache/arrow-site" ]; then
-            # Production
-            TARGET_BRANCH=asf-site
-          else
-            # On a fork, so we'll deploy to GitHub Pages
-            TARGET_BRANCH=gh-pages
-          fi
+          . ../env.sh
           git config user.name "$(git log -1 --pretty=format:%an)"
           git config user.email "$(git log -1 --pretty=format:%ae)"
           git remote add deploy \
-            https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
+            https://x-access-token:${GITHUB_TOKEN}@github.com/${ORIGIN}.git
           if ! git checkout ${TARGET_BRANCH}; then
             git checkout -b ${TARGET_BRANCH} remotes/origin/asf-site
           fi