Skip to content

Commit

Permalink
FAIRSPC-87: added workflow to Build and deploy docs to Github Pages a…
Browse files Browse the repository at this point in the history
…nd fixed table in doc
  • Loading branch information
tgreenwood committed Jun 10, 2024
1 parent ea7b39d commit c016121
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 23 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/build_and_deploy_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,19 @@ jobs:
with:
ruby-version: '2.7'

- name: Install Asciidoctor
- name: Install Asciidoctor to build docs
run: |
gem install asciidoctor
gem install asciidoctor-pdf
gem install rouge
- name: Run Build Docs script
run: ./docs/build.sh
run: ./docs/scripts/build.sh

- name: Run Deploy Docs script
run: ./docs/deploy.sh
env:
CI_SERVICE_ACCOUNT_USER: ${{ secrets.CI_SERVICE_ACCOUNT_USER }}
CI_SERVICE_ACCOUNT_PASSWORD: ${{ secrets.FNS_PAT }}
DOCUMENTATION_REPO: ${{ vars.DOCUMENTATION_REPO }}
run: ./docs/scripts/deploy.sh

18 changes: 0 additions & 18 deletions docs/deploy.sh

This file was deleted.

10 changes: 8 additions & 2 deletions docs/build.sh → docs/scripts/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env bash
# the script builds the documentation and saves it to the build directory to be deployed by the deploy.sh script
set -e

PROJECT_FILES=(
"projects/saturn/src/main/resources/log4j2.properties"
Expand All @@ -8,9 +10,13 @@ PROJECT_FILES=(
"projects/saturn/vocabulary.ttl"
)


# Set working directory
# Get the directory where the script is located
here=$(dirname "${0}")
pushd "${here}"
# Move one level up from the script's directory
parent_dir=$(cd "${here}/.." && pwd)

pushd "${parent_dir}"
version=$(cat ../VERSION)
mkdir -p build/docs
cp ../README.adoc build/
Expand Down
30 changes: 30 additions & 0 deletions docs/scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# the script pulls the documentation repository, copies the built documentation to the repository, commits and pushes the changes
# the documentation repository is configured to deploy the documentation to the GitHub Pages on push to the main branch
set -e

# Set working directory
# Get the directory where the script is located
here=$(dirname "${0}")
# Move two levels up from the script's directory
parent_dir=$(cd "${here}/../../" && pwd)

export DOCS_REPO="https://${CI_SERVICE_ACCOUNT_USER}:${CI_SERVICE_ACCOUNT_PASSWORD}@github.com/thehyve/${DOCUMENTATION_REPO}"
echo "Cloning documentation repository ${DOCS_REPO} ..."
git clone --branch main "${DOCS_REPO}" fairspace-docs
git config --global user.email "[email protected]"
git config --global user.name "${CI_SERVICE_ACCOUNT_USER}"
export DOCS_DIR=$(pwd)/fairspace-docs

cp -r ./fairspace/fairspace/docs/build/* "${DOCS_DIR}/"

pushd "${DOCS_DIR}"
if [ ! "$(git status -s)" == "" ]; then
echo "Committing changes to ${DOCUMENTATION_REPO} ..."
git add .
git commit -a -m "Update documentation"
git push "${DOCS_REPO}" main
else
echo "Documentation unchanged."
fi
popd

0 comments on commit c016121

Please sign in to comment.