Skip to content

Commit 7fbee50

Browse files
committed
Switch to GitHub actions for sonatype OSS deploy
1 parent 82c448b commit 7fbee50

4 files changed

Lines changed: 62 additions & 7 deletions

File tree

.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: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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
43+
- name: Build, verify, deploy
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

.maven-settings.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,12 @@
121121
<activeProfile>default</activeProfile>
122122
</activeProfiles>
123123

124+
<servers>
125+
<server>
126+
<id>ossrh</id>
127+
<username>${env.SONATYPE_USERNAME}</username>
128+
<password>${env.SONATYPE_PASSWORD}</password>
129+
</server>
130+
</servers>
131+
124132
</settings>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ under the License.
669669
<site>
670670
<id>${site.deploy.id}</id>
671671
<name>Maven Site Deployment</name>
672-
<url>${site.deploy.url}${site.url.module.prefix}</url>
672+
<url>${site.deploy.url}/${site.url.module.prefix}</url>
673673
</site>
674674
</distributionManagement>
675675

0 commit comments

Comments
 (0)