Auto update built-in

This commit is contained in:
JAremko 2021-01-08 10:08:08 +02:00 committed by Eugene Yaremenko
parent ee9201efe7
commit bfed28d3c2
4 changed files with 65 additions and 7 deletions

12
.ci/built_in_manifest Normal file
View File

@ -0,0 +1,12 @@
https://raw.githubusercontent.com/magnars/dash.el/master/dash.el core/libs/dash.el
https://raw.githubusercontent.com/creichert/ido-vertical-mode.el/master/ido-vertical-mode.el core/libs/ido-vertical-mode.el
https://raw.githubusercontent.com/sigma/mocker.el/master/mocker.el core/libs/mocker.el
https://raw.githubusercontent.com/melpa/package-build/master/package-build.el core/libs/package-build.el
https://raw.githubusercontent.com/melpa/package-build/master/package-recipe-mode.el core/libs/package-recipe-mode.el
https://raw.githubusercontent.com/quelpa/quelpa/master/quelpa.el core/libs/quelpa.el
https://raw.githubusercontent.com/Malabarba/spinner.el/master/spinner.el core/libs/spinner.el
https://raw.githubusercontent.com/Wilfred/ht.el/master/ht.el core/libs/ht.el
https://raw.githubusercontent.com/diasjorge/emacs-load-env-vars/master/load-env-vars.el core/libs/load-env-vars.el
https://raw.githubusercontent.com/melpa/package-build/master/package-build-badges.el core/libs/package-build-badges.el
https://raw.githubusercontent.com/melpa/package-build/master/package-recipe.el core/libs/package-recipe.el
https://raw.githubusercontent.com/purcell/page-break-lines/master/page-break-lines.el core/libs/page-break-lines.el

View File

@ -25,7 +25,7 @@ script:
deploy:
- provider: script
skip_cleanup: true
script: ".travisci/pub_org.sh"
script: ".travisci/pub_auto_update.sh"
on:
branch: develop
condition: $TRAVIS_REPO_SLUG = $SPACEMACS_REPO_SLUG

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
## ORG documentation publishing script for Travis CI integration
## Auto-update publishing script for Travis CI integration
##
## Copyright (c) 2012-2014 Sylvain Benner
## Copyright (c) 2014-2018 Sylvain Benner & Contributors
@ -39,7 +39,7 @@ if [ $? -ne 0 ]; then
fi
fold_end "CLONING_TARGET_REPOSITORY"
fold_start "APPLYING DOCUMENTATION PATCH"
fold_start "APPLYING_DOCUMENTATION_PATCH"
cd "/tmp/${PUBLISH}"
if [ ! -f /tmp/docfmt.patch ]; then
echo "Documentation doesn't need fixes. Aborting."
@ -50,7 +50,20 @@ if [ $? -ne 0 ]; then
echo "Failed to apply documentation fixes patch"
exit 2
fi
fold_end "APPLYING DOCUMENTATION PATCH"
fold_end "APPLYING_DOCUMENTATION_PATCH"
fold_start "APPLYING_BUILT_IN_PATCH"
cd "/tmp/${PUBLISH}"
if [ ! -f /tmp/built_in.patch ]; then
echo "Built-in files don't need updating. Aborting."
exit 0
fi
git am < /tmp/built_in.patch
if [ $? -ne 0 ]; then
echo "Failed to apply built-in patch."
exit 2
fi
fold_end "APPLYING_BUILT_IN_PATCH"
fold_start "CHECKING_IF_SPACEMACS_HEAD_IS_THE_SAME"
cd ~/.emacs.d
@ -60,7 +73,7 @@ rem_rev=$(git rev-parse '@{u}')
echo "Base revision: $base_revision"
echo "Remote revision: $rem_rev"
if [ "$base_revision" != "$rem_rev" ]; then
echo "Looks like Spacemacs head has changed while we generated files."
echo "Looks like Spacemacs head has changed since CI started."
echo "Aborting."
exit 0
fi
@ -86,7 +99,7 @@ fi
fold_end "PUSHING_CHANGES_TO_${BOT_NAME}/${PUBLISH}"
fold_start "OPENING_PR_TO_SPACEMACS_REPO"
echo "[bot] Documentation formatting" > msg
echo "[bot] Auto-update" > msg
echo >> msg
echo "Merge with care - I'm just a stupid bot. Beep boop." >> msg
/tmp/hub pull-request -b "${TRAVIS_BRANCH}" -F msg

View File

@ -56,12 +56,45 @@ if [ $? -ne 0 ]; then
else
git format-patch -1 HEAD --stdout > /tmp/docfmt.patch
if [ $? -ne 0 ]; then
echo "Failed to create patch file."
echo "Failed to create documentation patch file."
exit 2
fi
cat /tmp/docfmt.patch
fi
git reset --hard HEAD~1
fold_end "CREATING_DOCUMENTATION_PATCH_FILE"
fold_start "UPDATING_BUILT_IN_FILES"
built_in_manifest="${TRAVIS_BUILD_DIR}/.ci/built_in_manifest"
lines=$(cat "${built_in_manifest}")
while read line; do
url=$(echo $line | cut -f1 -d " ")
target=$(echo $line | cut -f2 -d " ")
curl "${url}" --output "${TRAVIS_BUILD_DIR}/${target}"
if [ $? -ne 0 ]; then
echo "Failed to update built in file: ${target} from url: ${url}"
echo "Please update manifest file: .emacs.d/.ci/built_in_manifest"
exit 2
fi
done <"${built_in_manifest}"
fold_end "UPDATING_BUILT_IN_FILES"
fold_start "CREATING_BUILT_IN_PATCH_FILE"
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."
else
git format-patch -1 HEAD --stdout > /tmp/built_in.patch
if [ $? -ne 0 ]; then
echo "Failed to create built-in patch file."
exit 2
fi
cat /tmp/built_in.patch
fi
git reset --hard HEAD~1
fold_end "CREATING_BUILT_IN_PATCH_FILE"
rm -rf ~/.emacs.d
mv "${TRAVIS_BUILD_DIR}" ~/.emacs.d
cd ~/.emacs.d