[ci] fix layers.org gen
This commit is contained in:
parent
b992ad29bb
commit
daf108cb1b
|
@ -14,7 +14,7 @@ exit_if_no_changes
|
|||
|
||||
echo_headline "Cloning target repository"
|
||||
target_URL="https://github.com/${prj_owner}/${prj_repo}.git"
|
||||
git clone "${target_URL}" -b "${CIRCLE_BRANCH}" "/tmp/${PUBLISH}"
|
||||
git clone "${target_URL}" -b "${PR_BRANCH}" "/tmp/${PUBLISH}"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to clone \"${target_URL}\""
|
||||
exit 2
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#### Circle CI YAML file
|
||||
version: 2.1
|
||||
|
||||
parameters:
|
||||
prj_owner:
|
||||
type: string
|
||||
|
@ -7,22 +8,34 @@ parameters:
|
|||
prj_repo:
|
||||
type: string
|
||||
default: "spacemacs"
|
||||
prj_url:
|
||||
website_owner:
|
||||
type: string
|
||||
default: "https://github.com/syl20bnr/spacemacs"
|
||||
default: "syl20bnr"
|
||||
website_repo:
|
||||
type: string
|
||||
default: "develop.spacemacs.org"
|
||||
bot_login:
|
||||
type: string
|
||||
default: "SpacemacsBot"
|
||||
# Will be filled by setup script:
|
||||
is_branch_update:
|
||||
type: string
|
||||
default: "{{ IS_BRANCH_UDATE }}"
|
||||
|
||||
jobs:
|
||||
"Validate PR":
|
||||
executors:
|
||||
spacetools:
|
||||
docker:
|
||||
- image: jare/spacemacs-circleci:latest
|
||||
working_directory: ~/.emacs.d
|
||||
|
||||
jobs:
|
||||
"Validate PR":
|
||||
executor: spacetools
|
||||
environment:
|
||||
- UPD_BOT_LOGIN: << pipeline.parameters.bot_login >>
|
||||
- PRJ_OWNER: << pipeline.parameters.prj_owner >>
|
||||
- PRJ_REPO: << pipeline.parameters.prj_repo >>
|
||||
- BASH_ENV: ".circleci/shared"
|
||||
working_directory: ~/.emacs.d
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
|
@ -32,13 +45,12 @@ jobs:
|
|||
name: Make sure that this PR doesn't need rebase
|
||||
command: .circleci/PR_rebased
|
||||
"Validate Documentation":
|
||||
docker:
|
||||
- image: jare/spacemacs-circleci:latest
|
||||
executor: spacetools
|
||||
environment:
|
||||
- UPD_BOT_LOGIN: << pipeline.parameters.bot_login >>
|
||||
- PRJ_OWNER: << pipeline.parameters.prj_owner >>
|
||||
- PRJ_REPO: << pipeline.parameters.prj_repo >>
|
||||
- BASH_ENV: ".circleci/shared"
|
||||
working_directory: ~/.emacs.d
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
|
@ -48,16 +60,15 @@ jobs:
|
|||
name: validate changed documentation files
|
||||
command: .circleci/org/validate
|
||||
"Update built-in files":
|
||||
docker:
|
||||
- image: jare/spacemacs-circleci:latest
|
||||
executor: spacetools
|
||||
environment:
|
||||
- PRJ_OWNER: << pipeline.parameters.prj_owner >>
|
||||
- PRJ_REPO: << pipeline.parameters.prj_repo >>
|
||||
- BASH_ENV: ".circleci/shared"
|
||||
- PUBLISH: "spacemacs_built_in"
|
||||
- UPD_BOT_LOGIN: "SpacemacsBot"
|
||||
- UPD_BOT_REPO: "spacemacs"
|
||||
working_directory: ~/.emacs.d
|
||||
- PUBLISH: "built_in_updates"
|
||||
- UPD_BOT_LOGIN: << pipeline.parameters.bot_login >>
|
||||
- UPD_BOT_REPO: << pipeline.parameters.prj_repo >>
|
||||
- PR_BRANCH: "develop"
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
|
@ -79,16 +90,15 @@ jobs:
|
|||
name: Open PR if built in files must be updated
|
||||
command: .circleci/maybe_pr
|
||||
"Update documentation files":
|
||||
docker:
|
||||
- image: jare/spacemacs-circleci:latest
|
||||
executor: spacetools
|
||||
environment:
|
||||
- PRJ_OWNER: << pipeline.parameters.prj_owner >>
|
||||
- PRJ_REPO: << pipeline.parameters.prj_repo >>
|
||||
- BASH_ENV: ".circleci/shared"
|
||||
- PUBLISH: "spacemacs_fix_org"
|
||||
- UPD_BOT_LOGIN: "SpacemacsBot"
|
||||
- UPD_BOT_REPO: "spacemacs"
|
||||
working_directory: ~/.emacs.d
|
||||
- PUBLISH: "documentation_updates"
|
||||
- UPD_BOT_LOGIN: << pipeline.parameters.bot_login >>
|
||||
- UPD_BOT_REPO: << pipeline.parameters.prj_repo >>
|
||||
- PR_BRANCH: "develop"
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
|
@ -112,6 +122,36 @@ jobs:
|
|||
- run:
|
||||
name: Open PR if documentation needs fixes
|
||||
command: .circleci/maybe_pr
|
||||
"Update website documentation":
|
||||
executor: spacetools
|
||||
environment:
|
||||
- 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"
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Initialize bot account
|
||||
command: .circleci/bot_init
|
||||
- run:
|
||||
name: Export documentation files
|
||||
command: .circleci/web/htmlize
|
||||
- run:
|
||||
name: Create patch file with the updates
|
||||
command: .circleci/make_patch
|
||||
- run:
|
||||
name: Apply the patch file
|
||||
command: .circleci/apply_patch
|
||||
- run:
|
||||
name: Push changes to Spacemacs Bot account
|
||||
command: .circleci/push
|
||||
- run:
|
||||
name: Open PR if web documentation needs fixes
|
||||
command: .circleci/maybe_pr
|
||||
|
||||
workflows:
|
||||
version: 2.1
|
||||
|
@ -127,20 +167,19 @@ workflows:
|
|||
and:
|
||||
- equal: [<< pipeline.parameters.is_branch_update >>, "yes"]
|
||||
- equal: [<< pipeline.git.branch >>, "develop"]
|
||||
- equal: [<< pipeline.parameters.prj_url >>, << pipeline.project.git_url >>]
|
||||
jobs:
|
||||
- "Update documentation files"
|
||||
# - "Update website documentation"
|
||||
update-built-in-on-push:
|
||||
when:
|
||||
and:
|
||||
- equal: [<< pipeline.parameters.is_branch_update >>, "yes"]
|
||||
- equal: [<< pipeline.git.branch >>, "develop"]
|
||||
- equal: [<< pipeline.parameters.prj_url >>, << pipeline.project.git_url >>]
|
||||
jobs:
|
||||
- "Update built-in files"
|
||||
update-built-in-cron:
|
||||
update-built-in-on-schedule:
|
||||
when:
|
||||
equal: [<< pipeline.parameters.prj_url >>, << pipeline.project.git_url >>]
|
||||
equal: [<< pipeline.parameters.is_branch_update >>, "yes"]
|
||||
triggers:
|
||||
- schedule:
|
||||
cron: "0 0,6,12,18 * * *"
|
||||
|
|
|
@ -10,6 +10,15 @@
|
|||
##
|
||||
## License: GPLv3
|
||||
|
||||
if [[ `git status --porcelain` ]]; then
|
||||
if [[ -z "$(git status --porcelain)" ]]; then
|
||||
git diff HEAD > "/tmp/${PUBLISH}.patch"
|
||||
echo "Changed files:"
|
||||
git status --porcelain
|
||||
echo "============================"
|
||||
echo "Patch:"
|
||||
cat "/tmp/${PUBLISH}.patch"
|
||||
echo "============================"
|
||||
else
|
||||
echo "No changes. Exiting."
|
||||
exit 0
|
||||
fi
|
||||
|
|
|
@ -15,11 +15,11 @@ exit_if_no_changes
|
|||
cd "/tmp/${PUBLISH}"
|
||||
|
||||
export GITHUB_TOKEN=$UPD_BOT_GIT_TK
|
||||
echo_headline "Opening PR to ${UPD_BOT_LOGIN}/${UPD_BOT_REPO} repo"
|
||||
echo_headline "Opening PR"
|
||||
echo "[bot] ${PUBLISH} updates" > msg
|
||||
echo >> msg
|
||||
echo "Merge with care - I'm just a stupid bot. Beep boop." >> msg
|
||||
hub pull-request -h "${PUBLISH}" -b "${CIRCLE_BRANCH}" -F msg
|
||||
hub pull-request -h "${PUBLISH}" -b "${PR_BRANCH}" -F msg
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Seems like PR already exists (not a problem)"
|
||||
fi
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
echo_headline "Generating new layers indext file data"
|
||||
spacedoc layers \
|
||||
-c".ci/spacedoc-cfg.edn" \
|
||||
"/tmp/sdn/"
|
||||
/tmp/sdn/layers
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Layers index generation failed."
|
||||
exit 2
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env bash
|
||||
## Export script for documentation files.
|
||||
##
|
||||
## 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
|
||||
|
||||
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/
|
Loading…
Reference in New Issue