Files
coursebook/_scripts/push_to_wiki.sh
T
Eric Zhang 8c49826577 Migrate to Github Actions (#184)
* Initial Github Actions workflow + script modifications

* Remove old keys

* Add deploy key

* Rename deploy key

* Oops add back

* Some changes after testing with website repo

* Remove env section

* Temporary changes for testing CI

* Enable github-actions on this branch for testing

* Fix?

* Only test out EPUB

* Fix?

* Fix?

* Update

* Typo and enable PDF

* Enable WIKI

* Add site deploy key

* Revert testing changes + Disable Github Actions on this branch

* Update README

* Typo

* Lowercase
2021-02-24 18:35:59 -08:00

33 lines
756 B
Bash

#!/bin/bash
# Every script should have this
set -e
DOCS_SHA=$(git rev-parse --short HEAD)
# Create a temp directory, so we don't get raced by the filesystem
WIKI_DIR=`mktemp -d`
CLONE_URL="git@github.com:${GITHUB_REPOSITORY}.wiki.git"
echo "Cloning $CLONE_URL into $WIKI_DIR"
git config --global core.sshCommand "ssh -i /tmp/deploy_wiki -F /dev/null"
git clone $CLONE_URL $WIKI_DIR
# If we get race condition on read only files, we need to fix our build system
# no temp directory here
echo "Copying Wiki"
cp _wiki/* ${WIKI_DIR}
cd ${WIKI_DIR}
git add -A
git commit -m "Updating wiki to ${DOCS_SHA}" --author "$COMMITTER_EMAIL <$AUTHOR_NAME>" || true
git push origin
cd ${GITHUB_WORKSPACE}
# Part 2, Update the site
bash _scripts/site_deploy.sh