Skip to content

Commit

Permalink
test docs on separate branch
Browse files Browse the repository at this point in the history
  • Loading branch information
wirednkod committed Aug 9, 2023
1 parent f79816a commit d5915db
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 6 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ jobs:
- name: Init install
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} && rustup component add clippy

- name: Create Docs
run: cargo doc --no-deps

- name: Run script for copying docs
- name: Run script for createing and copying docs in gh-pages branch
run: ./doc_preparation.sh

36 changes: 34 additions & 2 deletions doc_preparation.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,36 @@
#!/usr/bin/env bash
set -euxo pipefail

die() {
local msg="$*"
[[ -z "${msg}" ]] || {
echo "${RED}${msg}${RESET}" 1>&2
}
exit 1
}
readonly -f die

directory=docs
branch=gh-pages

echo -e "Deleting old content if exists..."
rm -rf $directory

echo -e "Checking out $branch...."
git worktree add $directory -f $branch

echo -e "Rebuilding docs..."
cargo doc --no-deps
rm -rf ./docs

echo -e "Preparing the link html and copying docs..."
echo "<meta http-equiv=\"refresh\" content=\"0; url=configuration\">" > target/doc/index.html
cp -r target/doc ./docs
cp -r target/doc $directory

echo -e "Deploying $branch branch..."
cd $directory &&
git add --all &&
GIT_COMMITTER_NAME='Docs builder' GIT_COMMITTER_EMAIL='info@parity.io' git commit --author "Docs builder <info@parity.io>" -m "Deploy updates" &&
git push origin $branch

echo -e "Cleaning up..."
git worktree remove -f $directory

0 comments on commit d5915db

Please sign in to comment.