Skip to content

Commit 9abe117

Browse files
committed
Switch to GitHub actions for sonatype OSS and site deploy
1 parent 6a4592a commit 9abe117

File tree

7 files changed

+122
-27
lines changed

7 files changed

+122
-27
lines changed

.github/workflows/maven-build.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# Default build validation "clean verify" for non-experimental branches
2-
# "master" branch is excluded, it's updated only on an gitflow release
1+
# Build validation
32

43
name: Build
54

65
on:
76
push:
87
branches-ignore:
9-
- 'master'
10-
- 'experimental/**'
8+
- master
9+
- experimental/**
1110
pull_request:
1211
branches-ignore:
13-
- 'master'
14-
- 'experimental/**'
12+
- master
13+
- experimental/**
14+
workflow_dispatch:
1515

1616
jobs:
1717
build:

.github/workflows/maven-deploy.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Deploy snapshots to Sonatpe OSS repository and deploy site to GitHub Pages
2+
3+
name: Deploy
4+
5+
on:
6+
push:
7+
branches:
8+
- develop
9+
workflow_dispatch:
10+
11+
jobs:
12+
build:
13+
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
# Check out Git repository
18+
- name: Checkout code
19+
uses: actions/checkout@v2
20+
21+
# Configure GIT
22+
- name: Configure GIT
23+
run: |
24+
git config --global user.email "${{ secrets.GH_SITE_DEPLOY_EMAIL }}"
25+
git config --global user.name "${{ secrets.GH_SITE_DEPLOY_NAME }}"
26+
27+
# Set up environment with Java and Maven
28+
- name: Setup JDK
29+
uses: actions/setup-java@v1
30+
with:
31+
java-version: 1.8
32+
33+
# Set up dependency cache
34+
- name: Cache local Maven repository
35+
uses: actions/cache@v2
36+
with:
37+
path: ~/.m2/repository
38+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
39+
restore-keys: |
40+
${{ runner.os }}-maven-
41+
42+
# Build, deploy to ossrh, generate and stage site
43+
- name: Build, verify, deploy, generate site
44+
env:
45+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
46+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
47+
run: mvn -s ./.maven-settings.xml -Pcontinuous-integration -B -U clean deploy site
48+
49+
# Deploy site to Github Pages
50+
- name: Stage and deploy site
51+
run: >
52+
mvn -s ./.maven-settings.xml -Pcontinuous-integration -B site:stage scm-publish:publish-scm
53+
-Dscmpublish.checkinComment="Maven site: ${{ github.repository }}"
54+
-Dusername=${{ secrets.GH_SITE_DEPLOY_USERNAME }}
55+
-Dpassword=${{ secrets.GH_SITE_DEPLOY_PAT }}

.maven-settings.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,4 +147,12 @@
147147
<activeProfile>default</activeProfile>
148148
</activeProfiles>
149149

150+
<servers>
151+
<server>
152+
<id>ossrh</id>
153+
<username>${env.SONATYPE_USERNAME}</username>
154+
<password>${env.SONATYPE_PASSWORD}</password>
155+
</server>
156+
</servers>
157+
150158
</settings>

parent_toplevel/pom.xml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
<site.url.module.prefix>tooling/parent_toplevel</site.url.module.prefix>
8383
<site.url>https://devops.wcm.io</site.url>
8484
<site.deploy.id>ssh-wcm.io</site.deploy.id>
85-
<site.deploy.url />
85+
<site.deploy.url>scm:git:https://github.com/wcm-io-devops/wcm-io-devops.github.io.git</site.deploy.url>
8686

8787
</properties>
8888

@@ -286,7 +286,8 @@
286286
<groupId>org.apache.maven.plugins</groupId>
287287
<artifactId>maven-javadoc-plugin</artifactId>
288288
<configuration>
289-
<excludePackageNames>*.impl</excludePackageNames>
289+
<excludePackageNames>*.impl:*.impl.*</excludePackageNames>
290+
<notimestamp>true</notimestamp>
290291
</configuration>
291292
</plugin>
292293

@@ -341,6 +342,19 @@
341342
</configuration>
342343
</plugin>
343344

345+
<plugin>
346+
<groupId>org.jacoco</groupId>
347+
<artifactId>jacoco-maven-plugin</artifactId>
348+
<reportSets>
349+
<reportSet>
350+
<reports>
351+
<!-- select non-aggregate reports -->
352+
<report>report</report>
353+
</reports>
354+
</reportSet>
355+
</reportSets>
356+
</plugin>
357+
344358
</plugins>
345359
</reporting>
346360

@@ -393,7 +407,7 @@
393407
<site>
394408
<id>${site.deploy.id}</id>
395409
<name>Maven Site Deployment</name>
396-
<url>${site.deploy.url}${site.url.module.prefix}</url>
410+
<url>${site.deploy.url}/${site.url.module.prefix}</url>
397411
</site>
398412
</distributionManagement>
399413

parent_toplevel/src/site/site.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@
129129
<item name="Issues" href="https://wcm-io.atlassian.net" />
130130
<item name="Wiki" href="https://wcm-io.atlassian.net/wiki/" />
131131
<item name="Mailing Lists" href="https://wcm.io/mailing-lists.html" />
132-
<item name="Continuous Integration" href="https://travis-ci.com/wcm-io-devops" />
133132
<item name="Fork on GitHub" href="http://github.com/wcm-io-devops" />
134133
</menu>
135134
<menu name="Maven documentation" inherit="top" ref="reports"/>

pom.xml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -54,32 +54,32 @@
5454
</configuration>
5555
</plugin>
5656

57-
<!-- do not generate site for this project -->
57+
<!-- do generate site for this project, but push it into a separate staging directory because we are not using it -->
5858
<plugin>
5959
<groupId>org.apache.maven.plugins</groupId>
6060
<artifactId>maven-site-plugin</artifactId>
6161
<configuration>
6262
<skipDeploy>true</skipDeploy>
63+
<stagingDirectory>${project.build.directory}/staging-not-used</stagingDirectory>
6364
</configuration>
6465
</plugin>
6566

66-
</plugins>
67-
<pluginManagement>
68-
<plugins>
69-
70-
<!-- license check -->
71-
<plugin>
72-
<groupId>org.codehaus.mojo</groupId>
73-
<artifactId>license-maven-plugin</artifactId>
74-
<configuration>
75-
<licenseName>apache_v2</licenseName>
76-
<addJavaLicenseAfterPackage>false</addJavaLicenseAfterPackage>
77-
<projectName>wcm.io</projectName>
78-
</configuration>
79-
</plugin>
67+
<plugin>
68+
<groupId>org.apache.maven.plugins</groupId>
69+
<artifactId>maven-scm-publish-plugin</artifactId>
70+
<configuration>
71+
<skipDeletedFiles>true</skipDeletedFiles>
72+
</configuration>
73+
</plugin>
8074

81-
</plugins>
82-
</pluginManagement>
75+
</plugins>
8376
</build>
8477

78+
<distributionManagement>
79+
<site>
80+
<id>${site.deploy.id}</id>
81+
<url>${site.deploy.url}</url>
82+
</site>
83+
</distributionManagement>
84+
8585
</project>

public_site/pom.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,26 @@
6363
</configuration>
6464
</plugin>
6565

66+
<plugin>
67+
<groupId>org.apache.maven.plugins</groupId>
68+
<artifactId>maven-site-plugin</artifactId>
69+
<configuration>
70+
<topSiteURL>${site.deploy.url}</topSiteURL>
71+
</configuration>
72+
</plugin>
73+
6674
</plugins>
75+
<pluginManagement>
76+
<plugins>
77+
<plugin>
78+
<groupId>org.apache.maven.plugins</groupId>
79+
<artifactId>maven-site-plugin</artifactId>
80+
<configuration>
81+
<topSiteURL>${project.distributionManagement.site.url}</topSiteURL>
82+
</configuration>
83+
</plugin>
84+
</plugins>
85+
</pluginManagement>
6786
</build>
6887

6988
<distributionManagement>

0 commit comments

Comments
 (0)