[ci] clean-up

This commit is contained in:
JAremko 2021-07-06 02:15:33 +03:00 committed by Eugene Yaremenko
parent 88cfc4bc67
commit a2e1c2de2e
5 changed files with 42 additions and 71 deletions

View File

@ -13,21 +13,29 @@
if [ ! -f "/tmp/${PUBLISH}.patch" ]; then
echo "No \"/tmp/${PUBLISH}.patch\" file. Aborting."
exit 0
else
echo_headline "Cloning target repository"
target_URL="https://github.com/${prj_owner}/${prj_repo}.git"
git clone "${target_URL}" -b "${CIRCLE_BRANCH}" "/tmp/${PUBLISH}"
if [ $? -ne 0 ]; then
echo "Failed to clone \"${target_URL}\""
exit 2
fi
cd "/tmp/${PUBLISH}"
echo_headline "Patching"
git apply --reject --whitespace=fix "/tmp/${PUBLISH}.patch"
if [ $? -ne 0 ]; then
echo "Failed to apply \"/tmp/${PUBLISH}.patch\"."
exit 2
fi
fi
echo_headline "Cloning target repository"
target_URL="https://github.com/${prj_owner}/${prj_repo}.git"
git clone "${target_URL}" -b "${CIRCLE_BRANCH}" "/tmp/${PUBLISH}"
if [ $? -ne 0 ]; then
echo "Failed to clone \"${target_URL}\""
exit 2
fi
cd "/tmp/${PUBLISH}"
echo_headline "Patching"
git apply --reject --whitespace=fix "/tmp/${PUBLISH}.patch"
if [ $? -ne 0 ]; then
echo "Failed to apply \"/tmp/${PUBLISH}.patch\"."
exit 2
fi
echo_headline "Creating commit"
git add --all
git commit -m "[bot] \"${PUBLISH}\" $(date -u)"
if [ $? -ne 0 ]; then
echo "Faild to create commit."
exit 2
fi

View File

@ -1,26 +0,0 @@
#!/usr/bin/env bash
## make_patch Creates patch file with updates of built-in Spacemacs files.
##
## Copyright (c) 2014-2021 Sylvain Benner & Contributors
##
## Author: Eugene Yaremenko
## URL: https://github.com/syl20bnr/spacemacs
##
## This file is not part of GNU Emacs.
##
## License: GPLv3
git add --all
git commit -m "Built-in files auto-update: $(date -u)"
if [ $? -ne 0 ]; then
echo "Built-in files don't need an update."
exit 0
else
git format-patch -1 HEAD --stdout > "/tmp/${PUBLISH}.patch"
if [ $? -ne 0 ]; then
echo "Failed to create built-in patch file."
exit 2
fi
git reset --hard HEAD~1
cat "/tmp/${PUBLISH}.patch"
fi

View File

@ -68,7 +68,7 @@ jobs:
command: .circleci/built_in/upd_built_in
- run:
name: Create patch file with the updates
command: .circleci/built_in/make_patch
command: .circleci/make_patch
- run:
name: Apply the patch file
command: .circleci/apply_patch
@ -102,7 +102,7 @@ jobs:
command: .circleci/org/update_docs
- run:
name: Create patch file with the updates
command: .circleci/org/make_patch
command: .circleci/make_patch
- run:
name: Apply the patch file
command: .circleci/apply_patch

15
.circleci/make_patch Executable file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env bash
## make_patch Creates patch file with the current changes.
##
## Copyright (c) 2014-2021 Sylvain Benner & Contributors
##
## Author: Eugene Yaremenko
## URL: https://github.com/syl20bnr/spacemacs
##
## This file is not part of GNU Emacs.
##
## License: GPLv3
if [[ `git status --porcelain` ]]; then
git diff HEAD > "/tmp/${PUBLISH}.patch"
fi

View File

@ -1,26 +0,0 @@
#!/usr/bin/env bash
## make_patch Generate patch file with Spacemacs documentation updates.
##
## Copyright (c) 2014-2021 Sylvain Benner & Contributors
##
## Author: Eugene Yaremenko
## URL: https://github.com/syl20bnr/spacemacs
##
## This file is not part of GNU Emacs.
##
## License: GPLv3
git add --all
git commit -m "documentation formatting: $(date -u)"
if [ $? -ne 0 ]; then
echo "Documentation is up to date."
exit 0
else
git format-patch -1 HEAD --stdout > "/tmp/${PUBLISH}.patch"
if [ $? -ne 0 ]; then
echo "Failed to create documentation patch file."
exit 2
fi
git reset --hard HEAD~1
cat "/tmp/${PUBLISH}.patch"
fi