Skip to content

Commit 240b5fc

Browse files
committed
Simplify workflow
1 parent 074c6b6 commit 240b5fc

File tree

2 files changed

+39
-79
lines changed

2 files changed

+39
-79
lines changed

.github/workflows/release.yml

Lines changed: 6 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ permissions:
1717

1818
jobs:
1919

20-
deploy-snapshot:
21-
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.snapshot == true)
20+
deploy:
21+
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
2222
runs-on: ubuntu-latest
2323
steps:
2424
- uses: actions/checkout@v6
@@ -31,11 +31,10 @@ jobs:
3131
- name: Grant Permission
3232
run: chmod +x ./mvnw
3333

34-
- name: Check SNAPSHOT version
35-
id: check-version
34+
- name: Validate SNAPSHOT version
35+
if: github.event_name == 'push' || inputs.snapshot == true
3636
run: |
3737
VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
38-
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
3938
if [[ "$VERSION" != *-SNAPSHOT ]]; then
4039
echo "::error::Version $VERSION is not a SNAPSHOT version"
4140
exit 1
@@ -54,47 +53,14 @@ jobs:
5453
"password": "${{ secrets.OSSRH_PASSWORD }}"
5554
}]
5655
57-
- name: Deploy Snapshot
58-
run: ./mvnw -B -ntp deploy -DskipTests
59-
60-
publish-release:
61-
if: github.event_name == 'workflow_dispatch' && inputs.snapshot == false
62-
runs-on: ubuntu-latest
63-
steps:
64-
- uses: actions/checkout@v6
65-
66-
- name: Grant Permission
67-
run: sudo chmod +x ./mvnw
68-
69-
- uses: actions/setup-java@v5
70-
with:
71-
distribution: 'corretto'
72-
java-version: '11'
73-
74-
- name: Remove old Maven Settings
75-
run: rm -f /home/runner/.m2/settings.xml
76-
77-
- name: Maven Settings
78-
uses: s4u/maven-settings-action@v4.0.0
79-
with:
80-
servers: |
81-
[{
82-
"id": "central",
83-
"username": "${{ secrets.OSSRH_USERNAME }}",
84-
"password": "${{ secrets.OSSRH_PASSWORD }}"
85-
}]
86-
8756
- name: Import GPG
8857
uses: crazy-max/ghaction-import-gpg@v7.0.0
8958
with:
9059
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
9160
passphrase: ${{ secrets.GPG_PASSPHRASE }}
9261

93-
- name: Build
94-
run: mvn -ntp -B clean verify install -DskipTests -Prelease
95-
96-
- name: Publish to Maven Central
62+
- name: Deploy
9763
env:
9864
GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }}
9965
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
100-
run: mvn -ntp -B deploy -DskipTests -Prelease -Dgpg.keyname=${GPG_KEY_NAME} -Dgpg.passphrase=${GPG_PASSPHRASE}
66+
run: ./mvnw -B -ntp deploy -DskipTests -Dgpg.keyname=${GPG_KEY_NAME} -Dgpg.passphrase=${GPG_PASSPHRASE}

pom.xml

Lines changed: 33 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,39 @@
399399
</executions>
400400
</plugin>
401401

402+
<plugin>
403+
<groupId>org.sonatype.central</groupId>
404+
<artifactId>central-publishing-maven-plugin</artifactId>
405+
<version>0.10.0</version>
406+
<extensions>true</extensions>
407+
<configuration>
408+
<publishingServerId>central</publishingServerId>
409+
</configuration>
410+
</plugin>
411+
412+
<plugin>
413+
<groupId>org.apache.maven.plugins</groupId>
414+
<artifactId>maven-gpg-plugin</artifactId>
415+
<version>3.2.8</version>
416+
<executions>
417+
<execution>
418+
<id>sign-artifacts</id>
419+
<phase>verify</phase>
420+
<goals>
421+
<goal>sign</goal>
422+
</goals>
423+
<configuration>
424+
<!-- Prevent gpg from using pinentry programs -->
425+
<gpgArguments>
426+
<arg>--pinentry-mode</arg>
427+
<arg>loopback</arg>
428+
</gpgArguments>
429+
<gpg.skip>false</gpg.skip>
430+
</configuration>
431+
</execution>
432+
</executions>
433+
</plugin>
434+
402435
<plugin>
403436
<groupId>org.revapi</groupId>
404437
<artifactId>revapi-maven-plugin</artifactId>
@@ -489,44 +522,5 @@
489522
</plugins>
490523
</build>
491524
</profile>
492-
493-
<!-- Release profile: activates central-publishing-maven-plugin and GPG signing -->
494-
<profile>
495-
<id>release</id>
496-
<build>
497-
<plugins>
498-
<plugin>
499-
<groupId>org.sonatype.central</groupId>
500-
<artifactId>central-publishing-maven-plugin</artifactId>
501-
<version>0.10.0</version>
502-
<extensions>true</extensions>
503-
<configuration>
504-
<publishingServerId>central</publishingServerId>
505-
</configuration>
506-
</plugin>
507-
<plugin>
508-
<groupId>org.apache.maven.plugins</groupId>
509-
<artifactId>maven-gpg-plugin</artifactId>
510-
<version>3.2.8</version>
511-
<executions>
512-
<execution>
513-
<id>sign-artifacts</id>
514-
<phase>verify</phase>
515-
<goals>
516-
<goal>sign</goal>
517-
</goals>
518-
<configuration>
519-
<gpgArguments>
520-
<arg>--pinentry-mode</arg>
521-
<arg>loopback</arg>
522-
</gpgArguments>
523-
<gpg.skip>false</gpg.skip>
524-
</configuration>
525-
</execution>
526-
</executions>
527-
</plugin>
528-
</plugins>
529-
</build>
530-
</profile>
531525
</profiles>
532526
</project>

0 commit comments

Comments
 (0)