Skip to content

Commit 012bdcc

Browse files
authored
Website with Hugo (apache#279)
An approach for the website using Hugo, built to support versioned docs for Polaris releases. "Released versions" are categorized into "active" and "EOL" versions - only the "actively maintained" versions appear in the menu in the navbar. ** Quickstart ** Just run the following command to let Hugo serve files from the Polaris `site/`. ```bash site/bin/run-hugo-in-docker.sh ``` Then point your browser to http://localhost:1313/ To stop the Hugo run ```bash site/bin/stop-hugo-in-docker.sh ``` (or just ctrl-C) See `README.md` in the `site/` directory for more options ** Versioned docs ** The idea here is that docs of releases live in either a separate branch or a separate Git repo. The `/releases` folder would _not_ be in the main Polaris repository (at least not in any code branch). It would be mounted either via `git worktree` or `git clone`. Building and testing the site locally works without the `/releases` folder. For developers, it is probably much easier to have a separate branch in the main Polaris GitHub repository and leverage Git worktrees. Docs for the current code branch (e.g. `main` branch) are maintained in the `/in-dev/unreleased` folder. While we could maintain the docs right in the `/in-dev` folder, having the in-dev docs in `/in-dev/unreleased` provides the ability to use relative links that still work when the docs are in an `/releases/x.y.z` folder (think: links like `../../guides/foo-bar.md`). Within a release's versioned docs folder, the release version number can be included in the markdown using the custom Hugo shortcode `{{< releaseVersion >}}`.
1 parent 853044f commit 012bdcc

File tree

94 files changed

+9722
-10976
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+9722
-10976
lines changed

.github/workflows/check-md-link.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,5 @@ jobs:
4141
with:
4242
use-quiet-mode: 'yes'
4343
config-file: '.github/workflows/check-md-link-config.json'
44-
folder-path: '.' # checks all md files
44+
folder-path: 'regtests, regtests/client/python/docs, regtests/client/python, .github, build-logic, polaris-core, polaris-service, extension, spec, k8, notebooks'
45+
file-path: 'CHAT_BYLAWS.md, CODE_OF_CONDUCT.md, CONTRIBUTING.md, README.md SECURITY.md'

.github/workflows/site.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
name: "Hugo Site"
21+
on:
22+
push:
23+
branches: [ "main", "versioned-docs" ]
24+
pull_request:
25+
26+
jobs:
27+
site:
28+
29+
runs-on: ubuntu-latest
30+
31+
steps:
32+
- uses: actions/checkout@v4
33+
- uses: actions/checkout@v4
34+
with:
35+
ref: "versioned-docs"
36+
path: site/content/releases
37+
38+
- name: Install docker-compose
39+
run: |
40+
sudo curl -SL \
41+
https://github.com/docker/compose/releases/download/v2.29.2/docker-compose-linux-x86_64 \
42+
-o /usr/local/bin/docker-compose
43+
sudo chmod 755 /usr/local/bin/docker-compose
44+
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
45+
46+
- name: Build Apache Site
47+
run: site/bin/create-static-site.sh
48+
49+
# TODO Do we want to deploy from 'asf-site' in the 'polaris-site' repo or in the 'polaris' repo?
50+
# The former requires a secret
51+
- name: Deploy Static Site to GitHub
52+
if: github.event_name == 'push' && github.repository == 'apache/polaris'
53+
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4
54+
with:
55+
github_token: ${{ secrets.GITHUB_TOKEN }}
56+
publish_branch: asf-site
57+
publish_dir: ./site/build/apache-site
58+
cname: polaris.apache.org

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ gradle/wrapper/gradle-wrapper-*.sha256
6464
**/build/
6565
!src/**/build/
6666

67+
# Possibly generated by npm from our Hugo container and leaking to the workspace - no need to track those in our case.
68+
node_modules/
69+
/package.json
70+
/package-lock.json
71+
6772
# jenv
6873
.java-version
6974

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,12 @@ Running regression tests
9090
- `docker compose up --build --exit-code-from regtest` - To run regression tests in a Docker environment.
9191

9292
Building docs
93-
- Docs are generated using [Redocly](https://redocly.com/docs/cli/installation). To regenerate them, run the following
94-
commands from the project root directory.
95-
```bash
96-
docs/build
97-
```
93+
- Docs are generated using [Hugo](https://gohugo.io/) using the [Docsy](https://www.docsy.dev/docs/) theme.
94+
- To view the site locally, run
95+
```bash
96+
site/bin/run-hugo-in-docker.sh
97+
```
98+
- See [README in `site/`](site/README.md) for more information.
9899

99100
## License
100101

build.gradle.kts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ tasks.named<RatTask>("rat").configure {
8787
excludes.add("polaris-service/src/**/banner.txt")
8888
excludes.add("polaris-service/logs")
8989

90+
excludes.add("site/node_modules/**")
91+
excludes.add("site/layouts/robots.txt")
92+
// Ignore generated stuff, when the Hugo is run w/o Docker
93+
excludes.add("site/public/**")
94+
excludes.add("site/resources/_gen/**")
95+
excludes.add("node_modules/**")
96+
9097
excludes.add("**/polaris-venv/**")
9198

9299
excludes.add("**/.pytest_cache/**")
@@ -110,6 +117,8 @@ tasks.named<RatTask>("rat").configure {
110117
excludes.add("**/*.lock")
111118

112119
excludes.add("**/*.env*")
120+
121+
excludes.add("**/go.sum")
113122
}
114123

115124
// Pass environment variables:

docs/CNAME

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/build

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)