Skip to content

Commit 0239598

Browse files
authored
add: GitHub action publish on central portal (#14)
* fix: test publish * fix: Inappropriate ioctl for device * fix: force * fix: user missed * fix: username missed * fix: simple * fix: change version * fix: build * fix: test using 1.7.0 * test: https://central.sonatype.org/publish/publish-portal-maven/#introduction * Revert "test: https://central.sonatype.org/publish/publish-portal-maven/#introduction" This reverts commit b418dc8. * Revert "Revert "test: https://central.sonatype.org/publish/publish-portal-maven/#introduction"" This reverts commit 17ce345. * fix: publish * fix: release * fix: prepare release
1 parent 2bae94f commit 0239598

2 files changed

Lines changed: 63 additions & 34 deletions

File tree

Lines changed: 53 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
2-
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
3-
41
name: Maven Package
52

63
on:
@@ -9,27 +6,63 @@ on:
96

107
jobs:
118
build:
12-
139
runs-on: ubuntu-latest
1410
permissions:
1511
contents: read
1612
packages: write
1713

1814
steps:
19-
- uses: actions/checkout@v2
20-
- name: Set up JDK 11
21-
uses: actions/setup-java@v2
22-
with:
23-
java-version: '11'
24-
distribution: 'temurin'
25-
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
26-
settings-path: ${{ github.workspace }} # location for the settings.xml file
15+
- uses: actions/checkout@v2
16+
- name: Set up JDK 11
17+
uses: actions/setup-java@v2
18+
with:
19+
java-version: '11'
20+
distribution: 'temurin'
21+
server-id: ossrh
22+
settings-path: ${{ github.workspace }}
23+
24+
- name: Import GPG key
25+
env:
26+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
27+
run: |
28+
echo "$GPG_PRIVATE_KEY" | gpg --batch --yes --import
29+
gpg --list-secret-keys
30+
31+
- name: Verify GPG Passphrase
32+
env:
33+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
34+
run: |
35+
echo "test message" | gpg --batch --yes --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" --sign --local-user maxiosorio@gmail.com
36+
37+
- name: Set up Maven settings
38+
run: |
39+
mkdir -p ~/.m2
40+
echo "<settings>
41+
<servers>
42+
<server>
43+
<id>central</id>
44+
<username>${{ secrets.OSSRH_USERNAME }}</username>
45+
<password>${{ secrets.OSSRH_PASSWORD }}</password>
46+
</server>
47+
</servers>
48+
<profiles>
49+
<profile>
50+
<id>gpg-sign</id>
51+
<properties>
52+
<gpg.executable>gpg</gpg.executable>
53+
<gpg.keyname>maxiosorio@gmail.com</gpg.keyname>
54+
<gpg.passphrase>${{ secrets.GPG_PASSPHRASE }}</gpg.passphrase>
55+
</properties>
56+
</profile>
57+
</profiles>
58+
<activeProfiles>
59+
<activeProfile>gpg-sign</activeProfile>
60+
</activeProfiles>
61+
</settings>" > ~/.m2/settings.xml
2762
28-
- name: Build with Maven
29-
run: mvn -B package --file pom.xml
30-
31-
- name: Publish to GitHub Packages Apache Maven
32-
run: mvn deploy
33-
env:
34-
GITHUB_USERNAME: ${{ secrets.GITHUB_USERNAME }}
35-
GITHUB_TOKEN: ${{ github.token }}
63+
- name: Publish to OSSRH
64+
run: mvn deploy
65+
env:
66+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
67+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
68+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

pom.xml

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
<groupId>edu.isi.kcap</groupId>
1212
<artifactId>ontapi</artifactId>
13-
<version>1.3.8</version>
13+
<version>1.4.0</version>
1414

1515
<scm>
1616
<connection>
@@ -64,13 +64,6 @@
6464
<maven.compiler.source>1.8</maven.compiler.source>
6565
</properties>
6666

67-
<distributionManagement>
68-
<snapshotRepository>
69-
<id>ossrh</id>
70-
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
71-
</snapshotRepository>
72-
</distributionManagement>
73-
7467
<!-- Dependencies -->
7568
<dependencies>
7669
<dependency>
@@ -152,14 +145,17 @@
152145
<finalName>maven-unit-test</finalName>
153146
<plugins>
154147
<plugin>
155-
<groupId>org.sonatype.plugins</groupId>
156-
<artifactId>nexus-staging-maven-plugin</artifactId>
157-
<version>1.6.13</version>
148+
<groupId>org.sonatype.central</groupId>
149+
<artifactId>central-publishing-maven-plugin</artifactId>
150+
<version>0.5.0</version>
158151
<extensions>true</extensions>
159152
<configuration>
160-
<serverId>ossrh</serverId>
161-
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
162-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
153+
<publishingServerId>central</publishingServerId>
154+
<configuration>
155+
<publishingServerId>central</publishingServerId>
156+
<autoPublish>true</autoPublish>
157+
<waitUntil>published</waitUntil>
158+
</configuration>
163159
</configuration>
164160
</plugin>
165161
<plugin>

0 commit comments

Comments
 (0)