Skip to content

Commit

Permalink
Update the website on changes in doc/ folder
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
  • Loading branch information
martin-g committed Apr 12, 2023
1 parent fc39d86 commit a473f28
Show file tree
Hide file tree
Showing 9 changed files with 229 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .asf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,7 @@ notifications:
# Send individual PR comments/reviews to issues@
pullrequests_comment: issues@avro.apache.org
jira_options: link label worklog

publish:
whoami: asf-site
subdir: asf-site
214 changes: 214 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
name: Deploy Avro site

on:
push:
branches:
- master
- update-site
paths:
- .github/workflows/docs.yaml
- doc/**
- lang/c/**

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-website:
name: Build website
runs-on: ubuntu-latest
steps:
- name: Checkout docs sources
uses: actions/checkout@v3
with:
submodules: recursive

- uses: actions/setup-node@v3
with:
node-version: 16

- name: Install NPM dependencies
run: |
set -x
cd doc
npm install
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 0.111.3
extended: true

- name: Build docs
run: |
set -x
cd doc
hugo --minify --destination ../website --baseURL=/asf-site
- uses: actions/upload-artifact@v3
with:
name: website
path: website

build-api-c:
name: Build C API docs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Build C docs
run: |
set -x
sudo apt-get update -q
sudo apt-get install -q -y cmake liblzma-dev libsnappy-dev libjansson-dev zlib1g-dev pkg-config asciidoc source-highlight libsource-highlight-dev
cd lang/c
./build.sh clean docs
- uses: actions/upload-artifact@v3
with:
name: api-c
path: build/c/docs

build-api-cpp:
name: Build C++ API docs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Build C++ docs
run: |
set -x
sudo apt-get update -q
sudo apt-get install -q -y gcc g++ libboost-all-dev cmake doxygen
cd lang/c++
./build.sh clean doc
cp -r lang/c++/doc/html/* website/docs/++version++/api/cpp/html/
- uses: actions/upload-artifact@v3
with:
name: api-c++
path: lang/c++/doc/html

build-api-csharp:
name: Build C# API docs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Build C# docs
run: |
set -x
sudo apt-get update -q
sudo apt-get install -q -y wget libzstd-dev libicu-dev doxygen
sudo wget https://dot.net/v1/dotnet-install.sh
bash ./dotnet-install.sh --channel "7.0" --install-dir "$HOME/.dotnet"
cd lang/csharp
mkdir -p build/doc
doxygen Avro.dox
- uses: actions/upload-artifact@v3
with:
name: api-csharp
path: lang/csharp/doc/html

build-api-java:
name: Build Java API docs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Cache Local Maven Repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Setup Temurin JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 8

- name: Build Java docs
run: |
set -x
cd lang/java
mvn -Pdist javadoc::aggregate
cp -r target/apidocs/* ../../website/docs/++version++/api/java/
popd
- uses: actions/upload-artifact@v3
with:
name: api-java
path: lang/java/target/apidocs

push-website:
name: Push website
needs: [build-website, build-api-c, build-api-cpp, build-api-csharp, build-api-java]
runs-on: ubuntu-latest
steps:
- name: Checkout asf-site branch
uses: actions/checkout@v3
with:
ref: asf-site
path: asf-site

- uses: actions/upload-artifact@v3
with:
name: website
path: website

- uses: actions/download-artifact@v3
with:
name: api-c
path: api-c

- uses: actions/download-artifact@v3
with:
name: api-c++
path: api-c++

- uses: actions/download-artifact@v3
with:
name: api-csharp
path: api-csharp

- uses: actions/download-artifact@v3
with:
name: api-java
path: api-java

- name: Copy & push the generated HTML
run: |
set -x
mv api-c/* website/docs/++version++/api/c/
mv api-c++/* website/docs/++version++/api/cpp/html/
mv api-csharp/* website/docs/++version++/api/csharp/html/
mv api-java/* website/docs/++version++/api/java/
rmdir api-c api-c++ api-csharp api-java
cd asf-site
rsync \
-a \
--delete \
--exclude '/.git/' \
../website/ \
./
cp ../.asf.yaml .
touch .nojekyll
git status --porcelain
if [ "$(git status --porcelain)" != "" ]; then
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add --all
git commit -m 'Publish built docs triggered by ${{ github.sha }}'
git push || git push --force
fi
2 changes: 1 addition & 1 deletion doc/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ url = "http://www.apache.org/security/"

[[params.versions]]
version = "++version++ (Current)"
url = "/docs/++version++/"
url = "./docs/++version++/"

[[params.versions]]
version = "1.11.0"
Expand Down
2 changes: 1 addition & 1 deletion doc/content/en/docs/++version++/api-c++.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "C++ API"
linkTitle: "C++ API"
weight: 102
manualLink: /docs/++version++/api/cpp/html/
manualLink: ./docs/++version++/api/cpp/html/
---

<!--
Expand Down
2 changes: 1 addition & 1 deletion doc/content/en/docs/++version++/api-c.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "C API"
linkTitle: "C API"
weight: 101
manualLink: /docs/++version++/api/c/
manualLink: ./docs/++version++/api/c/
---

<!--
Expand Down
2 changes: 1 addition & 1 deletion doc/content/en/docs/++version++/api-csharp.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "C# API"
linkTitle: "C# API"
weight: 103
manualLink: /docs/++version++/api/csharp/html/
manualLink: ./docs/++version++/api/csharp/html/
---

<!--
Expand Down
2 changes: 1 addition & 1 deletion doc/content/en/docs/++version++/api-java.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Java API"
linkTitle: "Java API"
weight: 100
manualLink: /docs/++version++/api/java/
manualLink: ./docs/++version++/api/java/
---

<!--
Expand Down
2 changes: 1 addition & 1 deletion doc/layouts/partials/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
{{/* AVRO-3555: Don't inline the existing logo for now.
<span class="navbar-logo">{{ if .Site.Params.ui.navbar_logo }}{{ with resources.Get "icons/logo.svg" }}{{ ( . | minify).Content | safeHTML }}{{ end }}{{ end }}</span><span class="text-uppercase font-weight-bold">{{ .Site.Title }}</span>
*/}}
<span class="navbar-logo"><img src="/docs/++version++/logo.svg" width="100" height="30" style="margin: 0 10px"></span><span class="text-uppercase font-weight-bold">{{ .Site.Title }}</span>
<span class="navbar-logo"><img src="./docs/++version++/logo.svg" width="100" height="30" style="margin: 0 10px"></span><span class="text-uppercase font-weight-bold">{{ .Site.Title }}</span>
</a>

<div class="td-navbar-nav-scroll ml-md-auto" id="main_navbar">
Expand Down
5 changes: 5 additions & 0 deletions lang/c/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ do
make -C $build_dir test
;;

docs)
prepare_build
make -C $build_dir docs
;;

dist)
prepare_build
cp ../../share/VERSION.txt $root_dir
Expand Down

0 comments on commit a473f28

Please sign in to comment.