From 8f9b64f0756ba5706b8737f004fe5703761fc309 Mon Sep 17 00:00:00 2001 From: Chris Purta Date: Wed, 25 Jul 2018 13:49:19 -0700 Subject: [PATCH] Add update docs script to CI Added a script to CI that will use the jsonrpc tool to update rpc documentation then commit and push those to the wiki repo. --- .gitlab-ci.yml | 10 +++++++++ scripts/gitlab-rpc-docs.sh | 45 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100755 scripts/gitlab-rpc-docs.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d73d494b2..36d76bfde 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -220,6 +220,16 @@ test-rust-nightly: - rust - rust-nightly allow_failure: true +json-rpc-docs: + stage: docs + only: + - tags + - master + image: parity/rust:gitlab-ci + script: + - scripts/gitlab-rpc-docs.sh + tags: + - docs push-release: stage: push-release only: diff --git a/scripts/gitlab-rpc-docs.sh b/scripts/gitlab-rpc-docs.sh new file mode 100755 index 000000000..ff5962a2b --- /dev/null +++ b/scripts/gitlab-rpc-docs.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash + +clone_repos() { + git clone https://github.com/parity-js/jsonrpc.git jsonrpc + git clone https://github.com/paritytech/wiki.git wiki +} + +build_docs() { + cp parity-ethereum jsonrpc/.parity + npm install + npm run build:markdown +} + +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 +} + +setup_git() { + git config user.email "runner@parity.com" + git config user.name "Parity Runner" +} + +commit_files() { + git checkout -b rpcdoc-update-${CI_COMMIT_REF_NAME} + git commit . + git commit -m "Update docs to ${CI_COMMIT_REF_NAME}" + git tag -a "${CI_COMMIT_REF_NAME}" +} + +upload_files() { + git push --tags +} + +setup_git +clone_repos +cd jsonrpc +build_docs +cd .. +update_wiki_docs +cd wiki +commit_files +upload_files