Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify local and GitHub Actions website generation flow #274

Merged
merged 6 commits into from
Oct 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions .github/workflows/deploy-website.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,24 @@ jobs:
steps:
- name: Check out code
uses: actions/[email protected]
- uses: ruby/[email protected]
with:
working-directory: ./website
bundler-cache: true
- name: Configure Github Pages
uses: actions/[email protected]
- name: Generate documentation
run: ./generate-docs.sh
- name: Build website with Jekyll
uses: actions/[email protected]
with:
source: website/
destination: ./_site
working-directory: ./website
run: bundle exec jekyll build
- name: Validate HTML output
uses: anishathalye/[email protected]
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/[email protected]
with:
path: ./website/_site
deploy:
if: github.ref == 'refs/heads/master'
needs: build
Expand Down
6 changes: 3 additions & 3 deletions generate-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

set -e -u -o pipefail

REPOSIORY_ROOT="$(git rev-parse --show-toplevel)"
WEBSITE_ROOT="${REPOSIORY_ROOT}/website"
REPOSITORY_ROOT="$(git rev-parse --show-toplevel)"
WEBSITE_ROOT="${REPOSITORY_ROOT}/website"
japborst marked this conversation as resolved.
Show resolved Hide resolved

generate_homepage() {
local homepage="${WEBSITE_ROOT}/index.md"

echo "Generating ${homepage}..."
cat - "${REPOSIORY_ROOT}/README.md" > "${homepage}" << EOF
cat - "${REPOSITORY_ROOT}/README.md" > "${homepage}" << EOF
---
layout: default
title: Home
Expand Down
1 change: 1 addition & 0 deletions website/.ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.1.2
9 changes: 6 additions & 3 deletions website/Gemfile
Original file line number Diff line number Diff line change
@@ -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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For other reviewers: webrick is used by jekyll serve.

26 changes: 24 additions & 2 deletions website/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,27 @@ 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 Bundler issues
Comment on lines +27 to +32
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@japborst I changed the grammar of these headers on purpose: the topic is "switch​ing Ruby versions" and "resolve​ing Bundler issues". This also matches the format used for the top-level README. Any particular reason this was reverted?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted to be in line with the rest.

Copy link
Member

@Stephan202 Stephan202 Oct 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other headers do not use the imperative mood either?


On macOS, you may get an error such as the following 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
japborst marked this conversation as resolved.
Show resolved Hide resolved

The website is regenerated and deployed using the
Expand All @@ -33,6 +54,7 @@ Actions workflow any time a change is merged to `master`.
[error-prone-support-website]: https://error-prone.picnic.tech
[error-prone-support-website-deploy-workflow]: https://github.com/PicnicSupermarket/error-prone-support/actions/workflows/deploy-website.yaml
[jekyll]: https://jekyllrb.com
[jekyll-docs]: https://jekyllrb.com/docs/
[jekyll-docs-installation]: https://jekyllrb.com/docs/installation/
[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
7 changes: 1 addition & 6 deletions website/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,8 @@ description: >-
Error Prone extensions: extra bug checkers and a large battery of Refaster
templates.

# XXX: Investigate 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/[email protected]
theme: just-the-docs
plugins:
- jekyll-remote-theme
- jekyll-sitemap

# Files and directories not to be deployed through GitHub pages.
Expand Down