2018-08-26 00:44:08 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e # fail on any error
|
|
|
|
set -u # treat unset variables as error
|
|
|
|
|
|
|
|
clone_repos() {
|
|
|
|
echo "__________Clone repos__________"
|
|
|
|
git clone https://github.com/parity-js/jsonrpc.git jsonrpc
|
|
|
|
git clone https://github.com/paritytech/wiki.git wiki
|
2019-01-07 14:47:28 +01:00
|
|
|
git clone https://github.com/paritytech/parity-config-generator
|
2018-08-26 00:44:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
build_docs() {
|
|
|
|
echo "__________Build docs__________"
|
|
|
|
npm install
|
|
|
|
npm run build:markdown
|
|
|
|
}
|
|
|
|
|
2019-01-07 14:47:28 +01:00
|
|
|
build_config() {
|
|
|
|
echo "_______Build config docs______"
|
|
|
|
yarn install
|
|
|
|
AUTOGENSCRIPT=1 yarn generate-docs
|
|
|
|
}
|
|
|
|
|
2018-08-26 00:44:08 +02:00
|
|
|
update_wiki_docs() {
|
|
|
|
echo "__________Update WIKI docs__________"
|
|
|
|
for file in $(ls jsonrpc/docs); do
|
|
|
|
module_name=${file:0:-3}
|
|
|
|
mv jsonrpc/docs/$file wiki/JSONRPC-$module_name-module.md
|
|
|
|
done
|
2019-01-07 14:47:28 +01:00
|
|
|
mv parity-config-generator/docs/config.md wiki/Configuring-Parity-Ethereum.md
|
2018-08-26 00:44:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
setup_git() {
|
|
|
|
echo "__________Set github__________"
|
2019-01-07 14:47:28 +01:00
|
|
|
git config --global user.email "devops@parity.com"
|
|
|
|
git config --global user.name "Devops Parity"
|
2018-08-26 00:44:08 +02:00
|
|
|
}
|
|
|
|
|
2018-09-21 13:02:15 +02:00
|
|
|
set_remote_wiki() {
|
|
|
|
git config remote.origin.url "https://${GITHUB_TOKEN}@github.com/paritytech/wiki.git"
|
|
|
|
}
|
|
|
|
|
2018-08-26 00:44:08 +02:00
|
|
|
commit_files() {
|
|
|
|
echo "__________Commit files__________"
|
2018-10-09 15:32:07 +02:00
|
|
|
git checkout -b rpcdoc-update-${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}
|
2018-08-26 00:44:08 +02:00
|
|
|
git add .
|
2018-10-09 15:32:07 +02:00
|
|
|
git commit -m "Update docs to ${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}"
|
2019-01-07 14:47:28 +01:00
|
|
|
git tag -a -f "${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}" -m "Update RPC and config docs to ${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}"
|
2018-08-26 00:44:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
upload_files() {
|
|
|
|
echo "__________Upload files__________"
|
2019-01-07 14:47:28 +01:00
|
|
|
git push -q origin HEAD
|
|
|
|
git push -q -f --tags
|
2018-08-26 00:44:08 +02:00
|
|
|
}
|
|
|
|
|
2018-09-13 14:36:44 +02:00
|
|
|
RPC_TRAITS_DIR="rpc/src/v1/traits"
|
2018-09-11 09:38:35 +02:00
|
|
|
|
2018-08-26 00:44:08 +02:00
|
|
|
setup_git
|
|
|
|
clone_repos
|
2018-09-11 09:38:35 +02:00
|
|
|
mkdir -p "jsonrpc/.parity/$RPC_TRAITS_DIR"
|
2018-09-13 14:36:44 +02:00
|
|
|
cp $RPC_TRAITS_DIR/*.rs "jsonrpc/.parity/$RPC_TRAITS_DIR"
|
2018-08-26 00:44:08 +02:00
|
|
|
cd jsonrpc
|
|
|
|
build_docs
|
|
|
|
cd ..
|
2019-01-07 14:47:28 +01:00
|
|
|
cd parity-config-generator
|
|
|
|
build_config
|
|
|
|
cd ..
|
2018-08-26 00:44:08 +02:00
|
|
|
update_wiki_docs
|
|
|
|
cd wiki
|
2018-09-21 13:02:15 +02:00
|
|
|
set_remote_wiki
|
2018-08-26 00:44:08 +02:00
|
|
|
commit_files
|
|
|
|
upload_files
|