mirror of
https://github.com/depp/syncfiles.git
synced 2024-11-25 08:30:55 +00:00
Add script for building GitHub pages to branch
This commit is contained in:
parent
e5e7749d2e
commit
c7147b2737
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
/.user.bazelrc
|
/.user.bazelrc
|
||||||
/bazel-*
|
/bazel-*
|
||||||
|
/gh-pages
|
||||||
|
49
docs/push.sh
Executable file
49
docs/push.sh
Executable file
@ -0,0 +1,49 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Build the site and push it to GitHub pages.
|
||||||
|
set -e
|
||||||
|
|
||||||
|
root=$(git rev-parse --show-toplevel)
|
||||||
|
cd "$root"
|
||||||
|
|
||||||
|
if ! command -v frum >/dev/null ; then
|
||||||
|
echo >&2 "Error: frum is not installed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! git diff-index --quiet --cached HEAD -- docs ; then
|
||||||
|
echo >&2 "Error: uncommitted changes"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if ! git diff-files --quiet docs ; then
|
||||||
|
echo >&2 "Error: uncommitted changes"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
branch=$(git symbolic-ref HEAD)
|
||||||
|
if test "$branch" != refs/heads/main ; then
|
||||||
|
echo >&2 "Error: branch is not main"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
commit="$(git rev-parse HEAD)"
|
||||||
|
|
||||||
|
echo >&2 "Checking out gh-pages..."
|
||||||
|
if test -d gh-pages ; then
|
||||||
|
branch=$(git -C gh-pages symbolic-ref HEAD)
|
||||||
|
if test "$branch" != refs/heads/gh-pages ; then
|
||||||
|
echo >&2 "Error: gh-pages dir does not have gh-pages branch"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
git worktree add gh-pages
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo >&2 "Building site..."
|
||||||
|
(
|
||||||
|
cd docs
|
||||||
|
eval "$(sh -c 'frum init')"
|
||||||
|
bundle exec jekyll build --destination ../gh-pages
|
||||||
|
)
|
||||||
|
|
||||||
|
echo >&2 "Committing..."
|
||||||
|
cd gh-pages
|
||||||
|
git add .
|
||||||
|
git commit -m "Generated from commit ${commit}"
|
Loading…
Reference in New Issue
Block a user