diff --git a/.github/workflows/deploy-website.yaml b/.github/workflows/deploy-website.yaml index 985e646d31a..adfd832e5c3 100644 --- a/.github/workflows/deploy-website.yaml +++ b/.github/workflows/deploy-website.yaml @@ -2,7 +2,9 @@ name: Update `error-prone.picnic.tech` website content on: pull_request: push: - branches: [$default-branch] + branches: + - $default-branch] + - japborst/local-builds permissions: contents: read pages: write @@ -16,22 +18,24 @@ jobs: steps: - name: Check out code uses: actions/checkout@v3.0.2 + - uses: ruby/setup-ruby@v1.117.0 # Ruby version set in `.ruby-version`. + with: + working-directory: ./website + bundler-cache: true # Runs `bundle install` and caches installed gems automatically. - name: Configure Github Pages uses: actions/configure-pages@v2.1.1 - name: Generate documentation run: ./generate-docs.sh - name: Build website with Jekyll - uses: actions/jekyll-build-pages@v1.0.5 - with: - source: website/ - destination: ./_site + working-directory: ./website + run: bundle exec jekyll build - name: Validate HTML output - uses: anishathalye/proof-html@v1.4.1 - with: - directory: ./_site - check_external_hash: false + working-directory: ./website + run: bundle exec htmlproofer --check-external-hash false ./_site - name: Upload website as artifact uses: actions/upload-pages-artifact@v1.0.4 + with: + path: ./website/_site deploy: if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) needs: build diff --git a/website/.ruby-version b/website/.ruby-version new file mode 100644 index 00000000000..ef538c28109 --- /dev/null +++ b/website/.ruby-version @@ -0,0 +1 @@ +3.1.2 diff --git a/website/Gemfile b/website/Gemfile index cdeed141c67..734e7a144a8 100644 --- a/website/Gemfile +++ b/website/Gemfile @@ -1,5 +1,8 @@ +ruby File.read(".ruby-version").strip + source "https://rubygems.org" -gem "github-pages", "227" gem "html-proofer", "4.4.1" -gem "jekyll-remote-theme", "0.4.3" -gem "rake", "13.0.6" +gem "jekyll", "4.2.2" +gem "jekyll-sitemap", "1.4" +gem "just-the-docs", "0.4.0.rc2" +gem "webrick", "1.7" diff --git a/website/README.md b/website/README.md index b1d86745590..19a720d8e01 100644 --- a/website/README.md +++ b/website/README.md @@ -24,6 +24,26 @@ 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. +**Switch Ruby versions** + +The required Ruby version is set in `.ruby-version`. To switch, you can use +[rvm][rvm] to manage your Ruby version. + +**Resolve bundle issues** + +You may get a similar error when running `bundle install`: + +```sh +fatal error: 'openssl/ssl.h' file not found +``` + +In that case, run + +```sh +bundle config build.eventmachine --with-cppflags=-I$(brew --prefix openssl)/include +bundle install +``` + # Deployment The website is regenerated and deployed using the @@ -36,3 +56,4 @@ Actions workflow any time a change is merged to `master`. [jekyll-docs]: https://jekyllrb.com/docs/ [jekyll-docs-installation]: https://jekyllrb.com/docs/installation/ [localhost-port-4000]: http://127.0.0.1:4000 +[rvm]: https://rvm.io/ diff --git a/website/_config.yml b/website/_config.yml index 3e77e0c3696..53f419ae980 100644 --- a/website/_config.yml +++ b/website/_config.yml @@ -6,13 +6,8 @@ description: >- Error Prone extensions: extra bug checkers and a large battery of Refaster templates. -# XXX: Invesigate dropping the remote theme by instead managing just-the-docs -# using Bundler. This requires changes to the build setup. The upshot is that -# local and CI build environments would then be in sync. -# https://github.com/PicnicSupermarket/error-prone-support/pull/253#discussion_r982709523 -remote_theme: just-the-docs/just-the-docs@v0.4.0.rc2 +theme: just-the-docs plugins: - - jekyll-remote-theme - jekyll-sitemap # Files and directories not to be deployed through GitHub pages.