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

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

commit 333cc08ee4eb07239e788b8f13f59003ab3d6c2b
Author: Tobias Bouschen <tobias.bousc...@googlemail.com>
AuthorDate: Tue Feb 9 13:39:57 2021 +0100

    Use GitHub action env field to declare publish branch name
    
    Declares the publish branch name as a GitHub action 'env' field. This
    makes the value accessible for all steps of the job.
---
 .github/workflows/deploy-site.yml          | 13 ++++++++-----
 .github/workflows/recreate-site-branch.yml | 11 +++++++----
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/.github/workflows/deploy-site.yml 
b/.github/workflows/deploy-site.yml
index d61ecc4..1e6d0db 100644
--- a/.github/workflows/deploy-site.yml
+++ b/.github/workflows/deploy-site.yml
@@ -28,6 +28,11 @@ jobs:
   build:
     name: Build & Deploy Site
     runs-on: ubuntu-latest
+
+    env:
+      # The name of the branch used to publish the website build artifacts
+      BRANCH_NAME: publish
+
     steps:
       - name: Checkout
         uses: actions/checkout@v2
@@ -85,11 +90,9 @@ jobs:
       - name: Publish site branch
         if: success()
         run: |
-          branch_name="publish"
-
           echo "Checking out site branch"
-          git fetch origin $branch_name
-          git checkout -b $branch_name origin/$branch_name
+          git fetch origin ${{ env.BRANCH_NAME }}
+          git checkout -b ${{ env.BRANCH_NAME }} origin/${{ env.BRANCH_NAME }}
           echo
 
           # Drops all existing files and folders except the base folder and 
the resources excluded by the regex
@@ -127,5 +130,5 @@ jobs:
           echo
 
           echo "Pushing site branch"
-          git push origin $branch_name
+          git push origin ${{ env.BRANCH_NAME }}
         shell: 'bash'
diff --git a/.github/workflows/recreate-site-branch.yml 
b/.github/workflows/recreate-site-branch.yml
index 6b22b25..092560d 100644
--- a/.github/workflows/recreate-site-branch.yml
+++ b/.github/workflows/recreate-site-branch.yml
@@ -16,6 +16,11 @@ jobs:
   build:
     name: Build & Deploy Site
     runs-on: ubuntu-latest
+
+    env:
+      # The name of the branch used to publish the website build artifacts
+      BRANCH_NAME: publish
+
     steps:
       - name: Checkout
         uses: actions/checkout@v2
@@ -63,10 +68,8 @@ jobs:
       - name: Publish site branch
         if: success()
         run: |
-          branch_name="publish"
-
           echo "Creating orphan branch"
-          git checkout --orphan $branch_name
+          git checkout --orphan ${{ env.BRANCH_NAME }}
           echo
 
           echo "Dropping content other than site data"
@@ -85,5 +88,5 @@ jobs:
           echo
 
           echo "Pushing site branch"
-          git push -f origin $branch_name
+          git push -f origin ${{ env.BRANCH_NAME }}
         shell: 'bash'

Reply via email to