File tree 3 files changed +15
-40
lines changed
3 files changed +15
-40
lines changed Original file line number Diff line number Diff line change 1
1
name : Publish to Maven Central
2
2
on :
3
- workflow_dispatch :
4
- inputs :
5
- tag :
6
- description : ' Tag'
7
- required : true
8
- default : ' 0.0.0'
3
+ release :
4
+ types : [published]
9
5
jobs :
10
6
publish :
11
7
runs-on : ubuntu-latest
8
+ if : startsWith(github.ref, 'refs/tags/') # only allow publishing tagged versions
12
9
steps :
13
10
- uses : actions/checkout@v4
14
- with :
15
- ref : " refs/tags/${{ github.event.inputs.tag }}"
16
11
- uses : actions/setup-java@v4
17
12
with :
18
13
java-version : 21
19
14
distribution : ' zulu'
20
15
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 : Verify project version = ${{ github.event.inputs.tag }}
16
+ server-id : central
17
+ server-username : MAVEN_CENTRAL_USERNAME
18
+ server-password : MAVEN_CENTRAL_PASSWORD
19
+ - name : Verify project version = ${{ github.event.release.tag_name }}
25
20
run : |
26
21
PROJECT_VERSION=$(./mvnw help:evaluate "-Dexpression=project.version" -q -DforceStdout)
27
- test "$PROJECT_VERSION" = "${{ github.event.inputs.tag }}"
22
+ test "$PROJECT_VERSION" = "${{ github.event.release.tag_name }}"
28
23
- name : Deploy
29
24
run : ./mvnw deploy -B -DskipTests -Psign,deploy-central --no-transfer-progress
30
25
env :
31
- MAVEN_USERNAME : ${{ secrets.OSSRH_USERNAME }}
32
- MAVEN_PASSWORD : ${{ secrets.OSSRH_PASSWORD }}
26
+ MAVEN_CENTRAL_USERNAME : ${{ secrets.MAVEN_CENTRAL_USERNAME }}
27
+ MAVEN_CENTRAL_PASSWORD : ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
33
28
MAVEN_GPG_PASSPHRASE : ${{ secrets.RELEASES_GPG_PASSPHRASE }}
34
29
MAVEN_GPG_KEY : ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
35
30
MAVEN_GPG_KEY_FINGERPRINT : ${{ vars.RELEASES_GPG_KEY_FINGERPRINT }}
Original file line number Diff line number Diff line change 24
24
MAVEN_GPG_PASSPHRASE : ${{ secrets.RELEASES_GPG_PASSPHRASE }}
25
25
MAVEN_GPG_KEY : ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
26
26
MAVEN_GPG_KEY_FINGERPRINT : ${{ vars.RELEASES_GPG_KEY_FINGERPRINT }}
27
- - name : Slack Notification
28
- uses : rtCamp/action-slack-notify@v2
29
- env :
30
- SLACK_WEBHOOK : ${{ secrets.SLACK_WEBHOOK_URL }}
31
- SLACK_USERNAME : ' Cryptobot'
32
- SLACK_ICON :
33
- SLACK_ICON_EMOJI : ' :bot:'
34
- SLACK_CHANNEL : ' cryptomator-desktop'
35
- SLACK_TITLE : " Published ${{ github.event.repository.name }} ${{ github.event.release.tag_name }}"
36
- SLACK_MESSAGE : " Ready to <https://github.com/${{ github.repository }}/actions/workflows/publish-central.yml|deploy to Maven Central>."
37
- SLACK_FOOTER :
38
- MSG_MINIMAL : true
Original file line number Diff line number Diff line change 331
331
332
332
<profile >
333
333
<id >deploy-central</id >
334
- <distributionManagement >
335
- <repository >
336
- <id >ossrh</id >
337
- <name >Maven Central</name >
338
- <url >https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url >
339
- </repository >
340
- </distributionManagement >
341
334
<build >
342
335
<plugins >
343
336
<plugin >
344
- <groupId >org.sonatype.plugins </groupId >
345
- <artifactId >nexus-staging -maven-plugin</artifactId >
346
- <version >1 .7.0</version >
337
+ <groupId >org.sonatype.central </groupId >
338
+ <artifactId >central-publishing -maven-plugin</artifactId >
339
+ <version >0 .7.0</version >
347
340
<extensions >true</extensions >
348
341
<configuration >
349
- <serverId >ossrh</serverId >
350
- <nexusUrl >https://s01.oss.sonatype.org/</nexusUrl >
351
- <autoReleaseAfterClose >true</autoReleaseAfterClose >
342
+ <publishingServerId >central</publishingServerId >
343
+ <autoPublish >true</autoPublish >
352
344
</configuration >
353
345
</plugin >
354
346
</plugins >
You can’t perform that action at this time.
0 commit comments