Skip to content

Commit 222b8ef

Browse files
authored
Merge pull request #71 from secure-software-engineering/fix/deployment
update deployment to the new central publishing api
2 parents 74fb83a + 1ab838c commit 222b8ef

File tree

3 files changed

+30
-41
lines changed

3 files changed

+30
-41
lines changed

.github/workflows/deploy.yml

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,21 @@ on: [workflow_dispatch]
55
jobs:
66
deployment:
77
runs-on: ubuntu-latest
8+
name: Deploy to Maven
89
environment: Deploy
9-
name: PathExpression deployment
1010
steps:
1111
- name: Checkout source code
1212
uses: actions/checkout@v4
13-
# Sets up Java version
14-
- name: Set up Java
15-
uses: actions/setup-java@v4
13+
14+
- name: Deploy version
15+
uses: secure-software-engineering/actions/deployment/maven-deployment@maven-central-deploy
1616
with:
17-
distribution: 'adopt'
18-
java-package: 'jdk'
19-
java-version: '8'
20-
server-id: 'ossrh' # must match the serverId configured for the nexus-staging-maven-plugin
21-
server-username: OSSRH_USERNAME # Env var that holds your OSSRH user name
22-
server-password: OSSRH_PASSWORD # Env var that holds your OSSRH user pw
23-
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Substituted with the value stored in the referenced secret
24-
gpg-passphrase: SIGN_KEY_PASS # Env var that holds the key's passphrase
25-
- name: Build & Deploy PathExpression
26-
run: mvn -B -U clean deploy -Pdeployment
27-
env:
28-
SIGN_KEY_PASS: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }}
29-
OSSRH_USERNAME: ${{ secrets.SONATYPE_USER }}
30-
OSSRH_PASSWORD: ${{ secrets.SONATYPE_PW }}
17+
java-distribution: adopt
18+
java-version: 11
19+
server-id: central
20+
server-username: ${{ secrets.SONATYPE_USER }}
21+
server-password: ${{ secrets.SONATYPE_PW }}
22+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
23+
gpg-passphrase: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }}
24+
mvn-cli-args: '-DskipTests -Pdeployment'
25+
deploy-mode: release
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
name: Java CI with Maven
1+
name: Run Tests
22

33
on:
44
push:
5+
branches:
6+
- develop
7+
- master
58
pull_request:
69

710
jobs:

pom.xml

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,19 @@
4444
<id>deployment</id>
4545
<build>
4646
<plugins>
47-
<plugin>
48-
<groupId>org.sonatype.plugins</groupId>
49-
<artifactId>nexus-staging-maven-plugin</artifactId>
50-
<version>1.7.0</version>
51-
<extensions>true</extensions>
52-
<configuration>
53-
<serverId>ossrh</serverId>
54-
<nexusUrl>https://s01.oss.sonatype.org</nexusUrl>
55-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
56-
</configuration>
57-
</plugin>
47+
<plugin>
48+
<groupId>org.sonatype.central</groupId>
49+
<artifactId>central-publishing-maven-plugin</artifactId>
50+
<version>0.8.0</version>
51+
<extensions>true</extensions>
52+
<configuration>
53+
<deploymentName>${project.artifactId} ${project.version}</deploymentName>
54+
<!-- Same id as in the deployment workflow -->
55+
<publishingServerId>central</publishingServerId>
56+
<waitUntil>published</waitUntil>
57+
<autoPublish>true</autoPublish>
58+
</configuration>
59+
</plugin>
5860
<plugin>
5961
<groupId>org.apache.maven.plugins</groupId>
6062
<artifactId>maven-source-plugin</artifactId>
@@ -142,15 +144,4 @@
142144
<version>2.25.1</version>
143145
</dependency>
144146
</dependencies>
145-
146-
<distributionManagement>
147-
<snapshotRepository>
148-
<id>ossrh</id>
149-
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
150-
</snapshotRepository>
151-
<repository>
152-
<id>ossrh</id>
153-
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
154-
</repository>
155-
</distributionManagement>
156147
</project>

0 commit comments

Comments
 (0)