Skip to content

Commit

Permalink
Build website through Github Actions (#3092)
Browse files Browse the repository at this point in the history
* Use Hugo submodules

* Remove submodule

* Publish using Github Action

* Use Hugo submodules

* Remove submodule

* Publish using Github Action

* Add exclusion

* Fix CI for docs
  • Loading branch information
Fokko authored Aug 19, 2024
1 parent b97e42c commit c1b6955
Show file tree
Hide file tree
Showing 63 changed files with 7,909 additions and 105 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.


# Sample workflow for building and deploying a Hugo site to GitHub Pages
name: Deploy Hugo site to Pages

on:
# Runs on pushes targeting the default branch
push:
branches:
- main

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.132.1
steps:
- name: Install Hugo CLI
run: |
wget -q -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Install Dart Sass
run: sudo snap install dart-sass
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Node.js dependencies
working-directory: doc/
run: ls -lah && npm ci
- name: Build with Hugo
working-directory: doc/
env:
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
HUGO_ENVIRONMENT: production
TZ: America/Los_Angeles
run: |
hugo \
--gc \
--minify \
--baseURL "https://avro.apache.org/"
- name: Commit new site
run: |
set -ex
mv doc/public docs/
git config --global user.email "[email protected]"
git config --global user.name "Github Actions"
git checkout --orphan asf-site-staging
git add .
git commit -m "Update docs"
git checkout asf-site
git reset --hard asf-site-staging
git push origin asf-site --force
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

1 change: 0 additions & 1 deletion doc/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
public/
resources/
node_modules/
package-lock.json
.hugo_build.lock
22 changes: 0 additions & 22 deletions doc/Dockerfile

This file was deleted.

38 changes: 24 additions & 14 deletions doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@
This website is base on [Hugo](https://gohugo.io) and uses the [Docsy](https://www.docsy.dev/) theme.
Before building the website, you need to initialize submodules.

```
git submodule update --init --recursive
```sh
hugo mod get -u
```

## Previewing the website locally

```
# From the doc directory, you will need to do this at least once for our SCSS modifications
(cd doc && npm install)
```sh
# Serve the website dynamically using extended hugo:
hugo server --buildDrafts --buildFuture --bind 0.0.0.0 --navigateToChanged

Expand All @@ -31,7 +28,7 @@ stop with **Build build/staging-web/ manually now. Press a key to continue...**

At this point, from another terminal and in the Avro root directory, you can build the website:

```
```sh
# Install the necessary npm packages
docker run --entrypoint=sh --rm -v $(pwd):/src -p 1313:1313 jakejarvis/hugo-extended:latest \
-c "cd build/staging-web && npm install"
Expand All @@ -42,20 +39,33 @@ docker run --rm -v $(pwd):/src -p 1313:1313 jakejarvis/hugo-extended:latest \
sudo chown -R $USER:$USER build/staging-web
```

## Avro version

(TODO)
## New release

When a new version of Apache Avro is released:

1. Change the value of `params.avroversion` in `config.toml`
2. Add a new entry to the `Releases` pages in the `Blog` section, for example:

```sh
cp content/en/blog/releases/avro-1.12.0-released.md content/en/blog/releases/avro-1.13.0-released.md
```
cp content/en/blog/releases/avro-1.10.2-released.md content/en/blog/releases/avro-1.11.0-released.md
```

## Updating the https://avro.apache.org website from a distribution
### Upload the docs

Copy the Markdown content from the release tar to the `doc/content/en/docs/1.12.0`:

(TODO)
```sh
tar xvfz avro-src-1.12.0.tar.gz
```

Here we need to copy everything, except the `api/` directory to this repository. The markdown will be rendered using Hugo, and the API docs are already html, and will be served from the ASF SVN. The `api/` directory needs to be uploaded to SVN:

```sh
svn co https://svn.apache.org/repos/asf/avro/site
cd site/publish/docs/
mkdir 1.12.0
cd 1.12.0
mkdir api
cp -r ~/Desktop/avro-release-dist/avro-1.12.0/avro-doc-1.12.0/api/ api/
svn commit -m "Avro 1.12.0 release"
```
21 changes: 14 additions & 7 deletions doc/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ enableMissingTranslationPlaceholders = true

enableRobotsTXT = true

# Hugo allows theme composition (and inheritance). The precedence is from left to right.
theme = ["docsy"]

# Will give values to .Lastmod etc.
enableGitInfo = true

Expand Down Expand Up @@ -135,7 +132,7 @@ archived_version = false
# The version number for the version of the docs represented in this doc set.
# Used in the "version-banner" partial to display a version number for the
# current doc set.
version = "++version++"
version = "1.12.0"

# A link to latest version of the docs. Used in the "version-banner" partial to
# point people to the main doc site.
Expand Down Expand Up @@ -262,8 +259,12 @@ url = "http://www.apache.org/security/"
desc = "Discuss development issues around the project"

[[params.versions]]
version = "++version++ (Current)"
url = "/docs/++version++/"
version = "1.12.0"
url = "https://avro.apache.org/docs/1.12.0/"

[[params.versions]]
version = "1.11.3"
url = "https://avro.apache.org/docs/1.11.3/"

[[params.versions]]
version = "1.11.2"
Expand Down Expand Up @@ -416,4 +417,10 @@ url = "https://avro.apache.org/docs/1.11.0/"
[[params.versions]]
version = "1.0.0"
url = "https://avro.apache.org/docs/1.0.0/"


[module]
[module.hugoVersion]
extended = true
min = "0.110.0"
[[module.imports]]
path = "github.com/google/docsy"
2 changes: 1 addition & 1 deletion doc/content/en/_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ <h1 class="display-1 mt-0 mt-md-5 pb-4">Apache Avro™ - a data serialization sy
Learn from or connect with other users in our open and welcoming community. We'd love to hear from you!
{{% /blocks/feature %}}

{{< /blocks/section >}}
{{< /blocks/section >}}
40 changes: 40 additions & 0 deletions doc/content/en/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
title: Apache Avro
---

{{< blocks/cover title="Apache Avro™ " image_anchor="top" >}}
<a class="btn btn-lg btn-primary me-3 mb-4" href="docs/">
Learn More <i class="fas fa-arrow-alt-circle-right ms-2"></i>
</a>
<a class="btn btn-lg btn-secondary me-3 mb-4" href="project/download/">
Download <i class="fab fa-github ms-2 "></i>
</a>
<p class="lead mt-5">a data serialization system</p>
{{< blocks/link-down color="info" >}}
{{< /blocks/cover >}}


{{% blocks/lead color="primary" %}}

Apache Avro™ is the leading serialization format for record data, and first choice for streaming data pipelines. It offers excellent schema evolution, and has implementations for the JVM (Java, Kotlin, Scala, …), Python, C/C++/C#, PHP, Ruby, Rust, JavaScript, and even Perl.

{{% /blocks/lead %}}


{{< blocks/section color="dark" type="row">}}
<!-- Note: the number of feature blocks should be a multiple of 3 for optimal display -->

{{% blocks/feature icon="fab fa-java" title="Getting started with Java" url="/docs/++version++/getting-started-java" %}}
For Java / JVM users, find out everything you need to know about specifying a schema, (de)serializing Avro data and code generation.
{{% /blocks/feature %}}

{{% blocks/feature icon="fab fa-python" title="Getting started with Python" url="/docs/++version++/getting-started-python" %}}
For Python users, find out everything you need to know about specifying a schema and (de)serializing Avro data.
{{% /blocks/feature %}}

{{% blocks/feature icon="fad fa-comments" title="Join Our Community!" url="/community/" %}}
Learn from or connect with other users in our open and welcoming community. We'd love to hear from you!
{{% /blocks/feature %}}

{{< /blocks/section >}}

Loading

0 comments on commit c1b6955

Please sign in to comment.