Skip to content

Commit 2f39a22

Browse files
committed
Add Github action to publish docs to Github pages
Signed-off-by: Fabian Stäber <[email protected]>
1 parent 95b9418 commit 2f39a22

File tree

6 files changed

+115
-5
lines changed

6 files changed

+115
-5
lines changed
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Deploy Documentation to Github Pages
2+
3+
on:
4+
# Runs on pushes targeting the 1.0.x branch
5+
push:
6+
branches:
7+
- 1.0.x
8+
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
11+
12+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20+
concurrency:
21+
group: "pages"
22+
cancel-in-progress: false
23+
24+
# Default to bash
25+
defaults:
26+
run:
27+
shell: bash
28+
29+
jobs:
30+
# Build job
31+
build:
32+
runs-on: ubuntu-latest
33+
env:
34+
HUGO_VERSION: 0.115.4
35+
JAVA_HOME: /usr/lib/jvm/java-17-openjdk-amd64
36+
steps:
37+
- name: Install OpenJDK 17
38+
run: sudo apt-get -q install -y openjdk-17-jdk
39+
- name: Make 17 the default java version
40+
run: sudo update-alternatives --set java /usr/lib/jvm/java-17-openjdk-amd64/bin/java
41+
- name: Make 17 the default javadoc version
42+
run: sudo update-alternatives --set javadoc /usr/lib/jvm/java-17-openjdk-amd64/bin/javadoc
43+
- name: Print java and javadoc versions
44+
run: |
45+
echo 'java --version' && \
46+
java --version && \
47+
echo 'javadoc --version' && \
48+
javadoc --version && \
49+
echo 'echo $JAVA_HOME' && \
50+
echo $JAVA_HOME
51+
- name: Install Hugo CLI
52+
run: |
53+
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
54+
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
55+
#- name: Install Dart Sass
56+
# run: sudo snap install dart-sass
57+
- name: Checkout
58+
uses: actions/checkout@v3
59+
with:
60+
submodules: recursive
61+
fetch-depth: 0
62+
- name: Build client_java
63+
run: ./mvnw -B clean install -DskipTests
64+
- name: Make Javadoc
65+
run: ./mvnw -B compile javadoc:javadoc javadoc:aggregate
66+
- name: Move the Javadoc to docs/static/api/
67+
run: mv ./target/site/apidocs ./docs/static/api && echo && echo 'ls ./docs/static/api' && ls ./docs/static/api
68+
- name: Setup Pages
69+
id: pages
70+
uses: actions/configure-pages@v3
71+
- name: Install Node.js dependencies
72+
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
73+
working-directory: ./docs
74+
- name: Build with Hugo
75+
env:
76+
# For maximum backward compatibility with Hugo modules
77+
HUGO_ENVIRONMENT: production
78+
HUGO_ENV: production
79+
run: |
80+
hugo \
81+
--gc \
82+
--minify \
83+
--baseURL "${{ steps.pages.outputs.base_url }}/"
84+
working-directory: ./docs
85+
- name: ls ./docs/public/api
86+
run: echo 'ls ./docs/public/api' && ls ./docs/public/api
87+
- name: Upload artifact
88+
uses: actions/upload-pages-artifact@v1
89+
with:
90+
path: ./docs/public
91+
92+
# Deployment job
93+
deploy:
94+
environment:
95+
name: github-pages
96+
url: ${{ steps.deployment.outputs.page_url }}
97+
runs-on: ubuntu-latest
98+
needs: build
99+
steps:
100+
- name: Deploy to GitHub Pages
101+
id: deployment
102+
uses: actions/deploy-pages@v2

docs/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ rm -r ./docs/static/api
3131
mv ./target/site/apidocs ./docs/static/api
3232
```
3333

34+
Github pages are in the `/client_java/` folder, so we link to `/client_java/api` rather than `/api`.
35+
To make JavaDoc work locally, create a link:
36+
37+
```
38+
mkdir ./docs/static/client_java
39+
ln -s ../api ./docs/static/client_java/api
40+
```
41+
3442
Update Geekdocs
3543
---------------
3644

docs/content/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "client_java"
33
---
44

5-
This is the documentation for the upcoming `client_java` 1.0.0 release. These docs are currently in progress. Target for the release is end of September 2023.
5+
This is the documentation for the upcoming Prometheus Java metrics 1.0.0 release. These docs are currently in progress. Target for the release is end of September 2023.
66

77
<- the navigation on the left has the sections that are already available.
88

docs/data/menu/more.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
more:
33
- name: JavaDoc
4-
ref: "/api"
4+
ref: "/client_java/api"
55
external: true
66
icon: "gdoc_bookmark"
77
- name: Releases

prometheus-metrics-core/src/main/java/io/prometheus/metrics/core/datapoints/StateSetDataPoint.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ public interface StateSetDataPoint extends DataPoint {
1818
void setFalse(String state);
1919

2020
/**
21-
* {@code state} must be one of the states from when the {@code StateSet} was created with {@link io.prometheus.metrics.core.metrics.StateSet.Builder#states(Class<? extends Enum<?>>)}.
21+
* {@code state} must be one of the states from when the {@code StateSet} was created with {@link io.prometheus.metrics.core.metrics.StateSet.Builder#states(Class)}.
2222
*/
2323
default void setTrue(Enum<?> state) {
2424
setTrue(state.toString());
2525
}
2626

2727
/**
28-
* {@code state} must be one of the states from when the {@code StateSet} was created with {@link io.prometheus.metrics.core.metrics.StateSet.Builder#states(Class<? extends Enum<?>>)}.
28+
* {@code state} must be one of the states from when the {@code StateSet} was created with {@link io.prometheus.metrics.core.metrics.StateSet.Builder#states(Class)}.
2929
*/
3030
default void setFalse(Enum<?> state) {
3131
setFalse(state.toString());

prometheus-metrics-core/src/main/java/io/prometheus/metrics/core/metrics/StateSet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
* this.name = name;
2828
* }
2929
*
30-
* @Override
30+
* // Override
3131
* public String toString() {
3232
* return name;
3333
* }

0 commit comments

Comments
 (0)