1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 03:57:21 +00:00

CI: Only commit if there are changes

Suggested by https://github.community/t/ignore-working-tree-clean/193304

We also get rid of `set -e` to simplify things
This commit is contained in:
jeremy@jermolene.com 2022-04-01 11:04:18 +01:00
parent dafb3f1c4f
commit e4b2698380
2 changed files with 15 additions and 21 deletions

View File

@ -84,14 +84,11 @@ rm $TWORG_BUILD_OUTPUT/build.tid || exit 1
# Push output back to GitHub # Push output back to GitHub
# Exit script immediately if any command fails pushd $TWORG_BUILD_OUTPUT || exit 1
set -e git config --global user.email "actions@github.com" || exit 1
git config --global user.name "GitHub Actions" || exit 1
pushd $TWORG_BUILD_OUTPUT git add -A . || exit 1
git config --global user.email "actions@github.com" git diff --exit-code || git commit --message "GitHub build: $GITHUB_RUN_NUMBER of $TW5_BUILD_BRANCH ($(date +'%F %T %Z'))" || exit 1
git config --global user.name "GitHub Actions" git remote add deploy "https://$GH_TOKEN@github.com/TiddlyWiki/tiddlywiki.org-gh-pages.git" &>/dev/null || exit 1
git add -A . git push deploy main &>/dev/null || exit 1
git commit --message "GitHub build: $GITHUB_RUN_NUMBER of $TW5_BUILD_BRANCH ($(date +'%F %T %Z'))"
git remote add deploy "https://$GH_TOKEN@github.com/TiddlyWiki/tiddlywiki.org-gh-pages.git" &>/dev/null
git push deploy main &>/dev/null
popd popd

View File

@ -2,14 +2,11 @@
# Push output back to GitHub # Push output back to GitHub
# Exit script immediately if any command fails cd output || exit 1
set -e git config --global user.email "actions@github.com" || exit 1
git config --global user.name "GitHub Actions" || exit 1
cd output git add -A . || exit 1
git config --global user.email "actions@github.com" git diff --exit-code || git commit --message "GitHub build: $GITHUB_RUN_NUMBER of $TW5_BUILD_BRANCH ($(date +'%F %T %Z'))" || exit 1
git config --global user.name "GitHub Actions" git remote add deploy "https://$GH_TOKEN@github.com/Jermolene/jermolene.github.io.git" || exit 1
git add -A . git push deploy master || exit 1
git commit --message "GitHub build: $GITHUB_RUN_NUMBER of $TW5_BUILD_BRANCH ($(date +'%F %T %Z'))" cd .. || exit 1
git remote add deploy "https://$GH_TOKEN@github.com/Jermolene/jermolene.github.io.git" &>/dev/null
git push deploy master &>/dev/null
cd ..