You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-dev@db.apache.org by to...@apache.org on 2021/02/09 14:54:59 UTC

[db-jdo-site] branch exit-cleanly-if-nothing-to-deploy created (now f5d09d8)

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

tobous pushed a change to branch exit-cleanly-if-nothing-to-deploy
in repository https://gitbox.apache.org/repos/asf/db-jdo-site.git.


      at f5d09d8  Only try to publish results if there are any changes

This branch includes the following new commits:

     new f5d09d8  Only try to publish results if there are any changes

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[db-jdo-site] 01/01: Only try to publish results if there are any changes

Posted by to...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tobous pushed a commit to branch exit-cleanly-if-nothing-to-deploy
in repository https://gitbox.apache.org/repos/asf/db-jdo-site.git

commit f5d09d8be2adb4d899973dc7883cb742f809cdf1
Author: Tobias Bouschen <to...@googlemail.com>
AuthorDate: Tue Feb 9 15:05:48 2021 +0100

    Only try to publish results if there are any changes
    
    Adjusts the deploy action to only try to commit and push if there are
    any staged changes. This avoids the action "failing" if there is nothing
    to commit.
---
 .github/workflows/deploy-site.yml | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/deploy-site.yml b/.github/workflows/deploy-site.yml
index 2f17dc4..fb0e7a9 100644
--- a/.github/workflows/deploy-site.yml
+++ b/.github/workflows/deploy-site.yml
@@ -124,15 +124,30 @@ jobs:
           rmdir -v -p target/site
 
 
-      # Publishes the build results
-      # Does nothing if there is nothing to publish
-      - name: Publish Results
+      - name: Stage Changes
+        id: stage-changes
         if: success()
         run: |
-          echo "Staging new content"
           git add -v -A
-          echo
 
+          if $(git diff -s --cached --exit-code)
+            then
+              # nothing staged
+              echo "Nothing to commit"
+              has_staged_changes=false
+            else
+              # something staged
+              has_staged_changes=true
+          fi
+
+          echo "::set-output name=HAS_STAGED_CHANGES::$has_staged_changes"
+
+
+      # Publishes the build results
+      # Does nothing if there is nothing to publish
+      - name: Publish Results
+        if: success() && steps.stage-changes.outputs.HAS_STAGED_CHANGES == 'true'
+        run: |
           echo "Committing changes"
           git commit -m "Auto-deploy site for commit ${{ steps.short-sha.outputs.SHORT_SHA }}"
           echo