[ci] move html export to CircleCI

This commit is contained in:
JAremko 2021-07-07 16:52:34 +03:00 committed by Eugene Yaremenko
parent 5c75eb4ea3
commit 8b832ecb4a
6 changed files with 76 additions and 20 deletions

View File

@ -27,6 +27,8 @@ executors:
docker:
- image: jare/spacemacs-circleci:latest
working_directory: ~/.emacs.d
environment:
- BASH_ENV: ".circleci/shared"
jobs:
"Validate PR":
@ -35,7 +37,6 @@ jobs:
- UPD_BOT_LOGIN: << pipeline.parameters.bot_login >>
- PRJ_OWNER: << pipeline.parameters.prj_owner >>
- PRJ_REPO: << pipeline.parameters.prj_repo >>
- BASH_ENV: ".circleci/shared"
steps:
- checkout
- run:
@ -50,7 +51,6 @@ jobs:
- UPD_BOT_LOGIN: << pipeline.parameters.bot_login >>
- PRJ_OWNER: << pipeline.parameters.prj_owner >>
- PRJ_REPO: << pipeline.parameters.prj_repo >>
- BASH_ENV: ".circleci/shared"
steps:
- checkout
- run:
@ -62,10 +62,9 @@ jobs:
"Update built-in files":
executor: spacetools
environment:
- PUBLISH: "built_in_updates"
- PRJ_OWNER: << pipeline.parameters.prj_owner >>
- PRJ_REPO: << pipeline.parameters.prj_repo >>
- BASH_ENV: ".circleci/shared"
- PUBLISH: "built_in_updates"
- UPD_BOT_LOGIN: << pipeline.parameters.bot_login >>
- UPD_BOT_REPO: << pipeline.parameters.prj_repo >>
- PR_BRANCH: "develop"
@ -92,10 +91,9 @@ jobs:
"Update documentation files":
executor: spacetools
environment:
- PUBLISH: "documentation_updates"
- PRJ_OWNER: << pipeline.parameters.prj_owner >>
- PRJ_REPO: << pipeline.parameters.prj_repo >>
- BASH_ENV: ".circleci/shared"
- PUBLISH: "documentation_updates"
- UPD_BOT_LOGIN: << pipeline.parameters.bot_login >>
- UPD_BOT_REPO: << pipeline.parameters.prj_repo >>
- PR_BRANCH: "develop"
@ -125,10 +123,9 @@ jobs:
"Update website documentation":
executor: spacetools
environment:
- PUBLISH: "website_documentation_updates"
- PRJ_OWNER: << pipeline.parameters.website_owner >>
- PRJ_REPO: << pipeline.parameters.website_repo >>
- BASH_ENV: ".circleci/shared"
- PUBLISH: "website_documentation_updates"
- UPD_BOT_LOGIN: << pipeline.parameters.bot_login >>
- UPD_BOT_REPO: << pipeline.parameters.website_repo >>
- PR_BRANCH: "gh-pages"
@ -137,12 +134,24 @@ jobs:
- run:
name: Initialize bot account
command: .circleci/bot_init
- run:
name: Install dependencies
command: .circleci/web/install_deps
- run:
name: Export documentation files
command: .circleci/web/htmlize
- run:
name: Clone website repo
command: |
git clone -b "${PR_BRANCH}" \
https://github.com/${PRJ_OWNER}/${PRJ_REPO} \
"/tmp/${PUBLISH}_old"
- run:
name: Replace old web files
command: rsync -avh ~/.emacs.d/export/ "/tmp/${PUBLISH}_old"
- run:
name: Create patch file with the updates
command: .circleci/make_patch
command: cd "/tmp/${PUBLISH}_old" && ~/.emacs.d/.circleci/make_patch
- run:
name: Apply the patch file
command: .circleci/apply_patch
@ -169,7 +178,7 @@ workflows:
- equal: [<< pipeline.git.branch >>, "develop"]
jobs:
- "Update documentation files"
# - "Update website documentation"
- "Update website documentation"
update-built-in-on-push:
when:
and:

View File

@ -23,6 +23,6 @@ else
echo "============================"
if [[ -z $(grep '[^[:space:]]' "/tmp/${PUBLISH}.patch") ]]; then
echo "\"/tmp/${PUBLISH}.patch\" is empty while the repo has changes."
exit 0
exit 2
fi
fi

View File

@ -16,7 +16,7 @@ cd "/tmp/${PUBLISH}"
export GITHUB_TOKEN=$UPD_BOT_GIT_TK
echo_headline "Opening PR"
echo "[bot] ${PUBLISH} updates" > msg
echo "[bot] ${PUBLISH}" > msg
echo >> msg
echo "Merge with care - I'm just a stupid bot. Beep boop." >> msg
hub pull-request -h "${PUBLISH}" -b "${PR_BRANCH}" -F msg

20
.circleci/web/.spacemacs Executable file
View File

@ -0,0 +1,20 @@
(defun dotspacemacs/layers ()
(setq-default
dotspacemacs-distribution 'spacemacs
dotspacemacs-configuration-layers '(
(org :variables
org-enable-github-support t
org-enable-bootstrap-support t
org-enable-reveal-js-support t
)
bibtex
(latex :variables
latex-enable-auto-fill t
latex-enable-folding t
)
html
)))
(defun dotspacemacs/init ())
(defun dotspacemacs/user-init ())
(defun dotspacemacs/config ())
(defun dotspacemacs/user-config ())

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
## Export script for documentation files.
## htmlize HTML export script for documentation files.
##
## Copyright (c) 2012-2014 Sylvain Benner
## Copyright (c) 2014-2022 Sylvain Benner & Contributors
@ -11,11 +11,19 @@
##
## License: GPLv3
mkdir -p "/tmp/sdn/"
echo_headline "Extract data out of documentation files into .sdn"
emacs -batch \
-l /opt/spacetools/spacedoc/sdnize/sdnize \
-no-site-file \
-q \
~/.emacs.d/ \
/tmp/sdn/
-l ~/.emacs.d/init.el \
-l ~/.emacs.d/core/core-documentation.el \
-f spacemacs/publish-doc
if [ $? -ne 0 ]; then
echo "spacemacs/publish-doc failed"
exit 2
fi
if [ -d ~/.emacs.d/export/ ]
then
echo "Export succeeded"
else
echo "~/.emacs.d/export/ doesn't exist"
exit 2
fi

19
.circleci/web/install_deps Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
## install_deps dependency installation for HTML export.
##
## Copyright (c) 2012-2014 Sylvain Benner
## Copyright (c) 2014-2022 Sylvain Benner & Contributors
##
## Author: Eugene Yaremenko
## URL: https://github.com/syl20bnr/spacemacs
##
## This file is not part of GNU Emacs.
##
## License: GPLv3
cp .circleci/web/.spacemacs ~/
emacs -batch -l ~/.emacs.d/init.el
if [ $? -ne 0 ]; then
echo "Dependencies installation failed."
exit 2
fi