Skip to content

Commit

Permalink
docs: add script to deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
marcofavorito committed Apr 13, 2024
1 parent f467e79 commit 2c1c84b
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions scripts/deploy-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env bash

set -x # un-comment to see what's going on when you run the script

GITHUB_REPONAME="whitemech/LydiaSyft"

# Create a temporary directory and store its name in a variable.
TEMPD=$(mktemp -d)

# Exit if the temp directory wasn't created successfully.
if [ ! -e "$TEMPD" ]; then
>&2 echo "Failed to create temp directory"
exit 1
fi

# generate documentation
doxygen Doxyfile

# copy generated HTML documentation in the temporary folder
cp -r ./docs/html/* "$TEMPD"

# move to temporary directory
CURDIR=$(pwd)
cd $TEMPD

# set up Git in temporary directory
git init
git checkout -b gh-pages
git add .
git commit -m "Deploy documentation"

git remote add origin "[email protected]:${GITHUB_REPONAME}.git"

# Push files
git push origin gh-pages --force

# return to previous directory
cd $CURDIR

# Make sure the temp directory gets removed on script exit.
trap "exit 1" HUP INT PIPE QUIT TERM
trap 'rm -rf "$TEMPD"' EXIT

0 comments on commit 2c1c84b

Please sign in to comment.