Skip to content

Commit 656f909

Browse files
deploy to central.sonatype.com
1 parent 540ac26 commit 656f909

File tree

3 files changed

+17
-50
lines changed

3 files changed

+17
-50
lines changed
Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,28 @@
11
name: Publish to Maven Central
22
on:
3-
workflow_dispatch:
4-
inputs:
5-
tag:
6-
description: 'Tag'
7-
required: true
8-
default: '0.0.0'
3+
release:
4+
types: [published]
95
jobs:
106
publish:
117
runs-on: macos-latest
8+
if: startsWith(github.ref, 'refs/tags/') # only allow publishing tagged versions
129
steps:
1310
- uses: actions/checkout@v4
14-
with:
15-
ref: "refs/tags/${{ github.event.inputs.tag }}"
1611
- uses: actions/setup-java@v4
1712
with:
1813
distribution: 'temurin'
1914
java-version: 17
2015
cache: 'maven'
21-
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
22-
server-username: MAVEN_USERNAME # env variable for username in deploy
23-
server-password: MAVEN_PASSWORD # env variable for token in deploy
24-
- name: Enforce project version ${{ github.event.inputs.tag }}
25-
run: mvn versions:set -B -DnewVersion=${{ github.event.inputs.tag }}
16+
server-id: central
17+
server-username: MAVEN_CENTRAL_USERNAME
18+
server-password: MAVEN_CENTRAL_PASSWORD
19+
- name: Enforce project version ${{ github.event.release.tag_name }}
20+
run: mvn versions:set -B -DnewVersion=${{ github.event.release.tag_name }}
2621
- name: Deploy
2722
run: mvn deploy -B -DskipTests -Psign,deploy-central --no-transfer-progress
2823
env:
29-
MAVEN_OPTS: >
30-
--add-opens=java.base/java.util=ALL-UNNAMED
31-
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED
32-
--add-opens=java.base/java.text=ALL-UNNAMED
33-
--add-opens=java.desktop/java.awt.font=ALL-UNNAMED
34-
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
24+
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
25+
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
3526
MAVEN_GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
3627
MAVEN_GPG_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
37-
MAVEN_GPG_KEY_FINGERPRINT: ${{ vars.RELEASES_GPG_KEY_FINGERPRINT }}
28+
MAVEN_GPG_KEY_FINGERPRINT: ${{ vars.RELEASES_GPG_KEY_FINGERPRINT }}

.github/workflows/publish-github.yml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,3 @@ jobs:
2222
MAVEN_GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
2323
MAVEN_GPG_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
2424
MAVEN_GPG_KEY_FINGERPRINT: ${{ vars.RELEASES_GPG_KEY_FINGERPRINT }}
25-
notify:
26-
runs-on: ubuntu-latest
27-
needs: [publish]
28-
steps:
29-
- name: Slack Notification
30-
uses: rtCamp/action-slack-notify@v2
31-
env:
32-
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
33-
SLACK_USERNAME: 'Cryptobot'
34-
SLACK_ICON:
35-
SLACK_ICON_EMOJI: ':bot:'
36-
SLACK_CHANNEL: 'cryptomator-desktop'
37-
SLACK_TITLE: "Published ${{ github.event.repository.name }} ${{ github.event.release.tag_name }}"
38-
SLACK_MESSAGE: "Ready to <https://github.com/${{ github.repository }}/actions/workflows/publish-central.yml|deploy to Maven Central>."
39-
SLACK_FOOTER:
40-
MSG_MINIMAL: true

pom.xml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
<!-- build plugin dependencies -->
4343
<dependency-check.version>12.1.0</dependency-check.version>
44-
<nexus-staging.version>1.7.0</nexus-staging.version>
44+
<central-publishing.version>0.7.0</central-publishing.version>
4545
</properties>
4646

4747
<licenses>
@@ -329,24 +329,16 @@
329329

330330
<profile>
331331
<id>deploy-central</id>
332-
<distributionManagement>
333-
<repository>
334-
<id>ossrh</id>
335-
<name>Maven Central</name>
336-
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
337-
</repository>
338-
</distributionManagement>
339332
<build>
340333
<plugins>
341334
<plugin>
342-
<groupId>org.sonatype.plugins</groupId>
343-
<artifactId>nexus-staging-maven-plugin</artifactId>
344-
<version>${nexus-staging.version}</version>
335+
<groupId>org.sonatype.central</groupId>
336+
<artifactId>central-publishing-maven-plugin</artifactId>
337+
<version>${central-publishing.version}</version>
345338
<extensions>true</extensions>
346339
<configuration>
347-
<serverId>ossrh</serverId>
348-
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
349-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
340+
<publishingServerId>central</publishingServerId>
341+
<autoPublish>true</autoPublish>
350342
</configuration>
351343
</plugin>
352344
</plugins>

0 commit comments

Comments
 (0)