diff --git a/.github/workflows/deploy-website.yaml b/.github/workflows/deploy-website.yaml index edb98a2cb42..2e0a5750e39 100644 --- a/.github/workflows/deploy-website.yaml +++ b/.github/workflows/deploy-website.yaml @@ -20,6 +20,8 @@ jobs: uses: actions/checkout@v3.0.2 - name: Configure Github Pages uses: actions/configure-pages@v2.0.0 + - name: Generate documentation + run: bash ./generate-docs.sh - name: Build website with Jekyll uses: actions/jekyll-build-pages@v1.0.5 with: diff --git a/generate-docs.sh b/generate-docs.sh index 94581b71afd..a7eba6274be 100755 --- a/generate-docs.sh +++ b/generate-docs.sh @@ -11,6 +11,12 @@ REFASTER_DOCS_FOLDER="${DOCS_FOLDER}/refastertemplates" HOMEPAGE="${WEBSITE_FOLDER}/index.md" +configure() { + cd "$(git rev-parse --show-toplevel || echo .)" + mkdir "${BUGPATTERN_FOLDER}" 2>/dev/null + mkdir "${REFASTER_FOLDER}" 2>/dev/null +} + generate_homepage() { echo "Generating ${HOMEPAGE}" cat > "${HOMEPAGE}" << EOF @@ -112,6 +118,7 @@ EOF } # Do it +configure generate_homepage generate_bugpattern_docs generate_refaster_docs diff --git a/website/.gitignore b/website/.gitignore index 140a1cba6e8..6443883887c 100644 --- a/website/.gitignore +++ b/website/.gitignore @@ -1,3 +1,9 @@ +# Jekyll generated files Gemfile.lock .sass-cache _site/ + +# Generated content +index.md +bugpatterns/ +refastertemplates/ diff --git a/website/README.md b/website/README.md index c28bf9feb17..71177edb783 100644 --- a/website/README.md +++ b/website/README.md @@ -1,7 +1,7 @@ # Error Prone Support website This directory contains the majority of the source code that powers -[error-prone.picnic.tech][https://error-prone.picnic.tech/]. The website is +[error-prone.picnic.tech][error-prone-support-website]. The website is statically generated using [Jekyll][jekyll]. # Local development @@ -11,7 +11,7 @@ instructions][jekyll-docs-installation]. Once done, in this directory execute: ```sh bundle install -bundle exec jekyll serve --livereload +../generate-docs.sh && bundle exec jekyll serve --livereload ``` The website will now be [available][localhost-port-4000] on port 4000. Source @@ -20,6 +20,12 @@ code modifications will automatically be reflected. (An exception is server restarts do not require running `bundle install`, unless `Gemfile` has been updated in the interim. +Documentation can be re-generated whist jekyll is running, by executing: + +```sh +../generate-docs.sh +``` + If you are not familiar with Jekyll, be sure to check out its [documentation][jekyll-docs]. It is recommended to follow the provided step-by-step tutorial.