Skip to content

Commit 13c7a91

Browse files
authored
feat: Generate javadocs and publish on GH Pages (#220)
1 parent 070c92f commit 13c7a91

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Generate Java Docs
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v2
15+
16+
- name: Set up JDK 11
17+
uses: actions/setup-java@v4
18+
with:
19+
java-version: 11
20+
distribution: corretto
21+
22+
- name: Build with Maven
23+
run: mvn clean install
24+
25+
- name: Generate Javadocs
26+
run: mvn javadoc:javadoc
27+
28+
# Publishes Javadocs to GitHub Pages by pushing to `gh-pages` branch
29+
- name: Deploy Javadocs to GitHub Pages
30+
run: |
31+
git config --global user.name 'github-actions[bot]'
32+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
33+
mvn scm-publish:publish-scm
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

pom.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,15 @@
393393
<plugins>
394394
<plugin>
395395
<artifactId>maven-compiler-plugin</artifactId>
396+
<executions>
397+
<execution>
398+
<id>default-compile</id>
399+
<phase>generate-sources</phase>
400+
<goals>
401+
<goal>compile</goal>
402+
</goals>
403+
</execution>
404+
</executions>
396405
<configuration>
397406
<source>11</source>
398407
<target>11</target>
@@ -509,6 +518,7 @@
509518
<plugin>
510519
<groupId>org.apache.maven.plugins</groupId>
511520
<artifactId>maven-javadoc-plugin</artifactId>
521+
<version>3.3.1</version>
512522
<executions>
513523
<execution>
514524
<id>attach-javadocs</id>
@@ -522,6 +532,16 @@
522532
<doclint>none</doclint>
523533
</configuration>
524534
</plugin>
535+
<plugin>
536+
<groupId>org.apache.maven.plugins</groupId>
537+
<artifactId>maven-scm-publish-plugin</artifactId>
538+
<version>1.0</version>
539+
<configuration>
540+
<content>target/site/apidocs</content>
541+
<pubScmUrl>scm:git:[email protected]:spotify/github-java-client.git</pubScmUrl>
542+
<scmBranch>gh-pages</scmBranch>
543+
</configuration>
544+
</plugin>
525545
</plugins>
526546
<pluginManagement>
527547
<plugins>

0 commit comments

Comments
 (0)