Skip to content

Commit 878baaa

Browse files
committed
DI deploy action updates
1 parent 648656f commit 878baaa

5 files changed

Lines changed: 60 additions & 132 deletions

File tree

.github/workflows/ci.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
2-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
3-
4-
# This workflow uses actions that are not certified by GitHub.
5-
# They are provided by a third-party and are governed by
6-
# separate terms of service, privacy policy, and support
7-
# documentation.
8-
91
name: Java CI with Maven
102

113
on:

.github/workflows/maven-deploy.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Maven Deploy
1+
name: Maven Deploy (Snapshots)
22

33
on:
44
push:
@@ -14,13 +14,14 @@ jobs:
1414
uses: actions/setup-java@v4
1515
with:
1616
java-version: '17'
17-
distribution: 'temurin'
18-
server-id: ossrh
19-
server-username: OSSRH_USERNAME
20-
server-password: OSSRH_TOKEN
17+
distribution: 'liberica'
18+
java-package: jdk+fx # optional (jdk, jre, jdk+fx or jre+fx) - defaults to jdk
19+
server-id: central
20+
server-username: MAVEN_USERNAME # env variable for username in deploy
21+
server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy
2122

22-
- name: Publish package
23+
- name: Publish Snapshot artifact
2324
run: mvn -B clean deploy
2425
env:
25-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
26-
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
26+
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
27+
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
Lines changed: 25 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,37 @@
11
name: Maven Publish manually
2-
on: workflow_dispatch
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: write
38

49
jobs:
5-
publish:
10+
publish-artifact:
611
runs-on: ubuntu-latest
12+
name: Publish artifact via Central Portal
713
steps:
8-
- uses: actions/checkout@v4
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
916
with:
1017
fetch-depth: 0
11-
- name: Set up Maven Central Repository
18+
ref: ${{ github.ref_name }}
19+
- name: Set up JDK 17
1220
uses: actions/setup-java@v4
1321
with:
1422
java-version: '17'
15-
distribution: 'temurin'
16-
cache: 'maven'
17-
server-id: ossrh
18-
server-username: OSSRH_USERNAME
19-
server-password: OSSRH_TOKEN
20-
21-
- name: Verify package
22-
run: mvn --batch-mode verify
23-
24-
- name: Decode and import GPG key to temp keyring
25-
run: |
26-
echo "$MAVEN_GPG_KEY" > private.key
27-
gpg --batch --import private.key
28-
KEY_ID=$(gpg --list-keys --with-colons | grep '^pub' | cut -d: -f5)
29-
echo "KEY_ID=$KEY_ID" >> $GITHUB_ENV
23+
distribution: 'liberica'
24+
java-package: jdk+fx # optional (jdk, jre, jdk+fx or jre+fx) - defaults to jdk
25+
cache: maven
26+
server-id: central
27+
server-username: MAVEN_USERNAME # env variable for username in deploy
28+
server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy
29+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
30+
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
31+
- name: Publish artifact
32+
run: mvn -B clean deploy -P release
3033
env:
31-
MAVEN_GPG_KEY: ${{ secrets.MAVEN_GPG_KEY }}
34+
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
35+
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
36+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
3237

33-
- name: Configure GPG
34-
run: |
35-
mkdir -p ~/.gnupg
36-
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf
37-
echo "use-agent" >> ~/.gnupg/gpg.conf
38-
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
39-
echo RELOADAGENT | gpg-connect-agent
40-
41-
- name: Deploy with Maven
42-
run: mvn --batch-mode deploy -DskipTests=true -P release -Dgpg.passphrase="${{ secrets.MAVEN_GPG_PASSPHRASE }}"
43-
env:
44-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
45-
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}

.github/workflows/maven-release.yml

Lines changed: 24 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,47 +4,34 @@ on:
44
release:
55
types: [ created ]
66

7+
permissions:
8+
contents: write
9+
710
jobs:
8-
publish:
11+
publish-artifact:
912
runs-on: ubuntu-latest
10-
permissions:
11-
contents: read
12-
packages: write
13-
13+
name: Publish artifact via Central Portal
1414
steps:
15-
- uses: actions/checkout@v4
16-
17-
- name: Set up Java for publishing to Maven Central
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
ref: ${{ github.ref_name }}
20+
- name: Set up JDK 17
1821
uses: actions/setup-java@v4
1922
with:
2023
java-version: '17'
21-
distribution: 'temurin'
22-
server-id: ossrh
23-
server-username: OSSRH_USERNAME
24-
server-password: OSSRH_TOKEN
25-
26-
- name: Verify package
27-
run: mvn --batch-mode verify
28-
29-
- name: Decode and import GPG key to temp keyring
30-
run: |
31-
echo "$MAVEN_GPG_KEY" > private.key
32-
gpg --batch --import private.key
33-
KEY_ID=$(gpg --list-keys --with-colons | grep '^pub' | cut -d: -f5)
34-
echo "KEY_ID=$KEY_ID" >> $GITHUB_ENV
35-
env:
36-
MAVEN_GPG_KEY: ${{ secrets.MAVEN_GPG_KEY }}
37-
38-
- name: Configure GPG
39-
run: |
40-
mkdir -p ~/.gnupg
41-
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf
42-
echo "use-agent" >> ~/.gnupg/gpg.conf
43-
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
44-
echo RELOADAGENT | gpg-connect-agent
45-
46-
- name: Deploy with Maven
47-
run: mvn --batch-mode deploy -DskipTests=true -P release -Dgpg.passphrase="${{ secrets.MAVEN_GPG_PASSPHRASE }}"
24+
distribution: 'liberica'
25+
java-package: jdk+fx # optional (jdk, jre, jdk+fx or jre+fx) - defaults to jdk
26+
cache: maven
27+
server-id: central
28+
server-username: MAVEN_USERNAME # env variable for username in deploy
29+
server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy
30+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
31+
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
32+
- name: Publish artifact
33+
run: mvn -B clean deploy -P release
4834
env:
49-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
50-
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
35+
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
36+
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
37+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

pom.xml

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@
9090
<plugin>
9191
<groupId>org.apache.maven.plugins</groupId>
9292
<artifactId>maven-javadoc-plugin</artifactId>
93-
<version>3.11.2</version>
9493
<executions>
9594
<execution>
9695
<id>attach-javadocs</id>
@@ -124,27 +123,6 @@
124123
</plugins>
125124
</build>
126125
</profile>
127-
128-
<profile>
129-
<id>javadoc-and-source</id>
130-
<build>
131-
<plugins>
132-
<plugin>
133-
<groupId>org.apache.maven.plugins</groupId>
134-
<artifactId>maven-javadoc-plugin</artifactId>
135-
<version>3.11.2</version>
136-
<executions>
137-
<execution>
138-
<id>attach-javadocs</id>
139-
<goals>
140-
<goal>jar</goal>
141-
</goals>
142-
</execution>
143-
</executions>
144-
</plugin>
145-
</plugins>
146-
</build>
147-
</profile>
148126
</profiles>
149127

150128
<build>
@@ -159,15 +137,11 @@
159137
<version>0.7.0</version>
160138
<extensions>true</extensions>
161139
<configuration>
162-
<publishingServerId>ossrh</publishingServerId>
140+
<publishingServerId>central</publishingServerId>
163141
<autoPublish>true</autoPublish>
142+
<waitUntil>uploaded</waitUntil>
164143
</configuration>
165144
</plugin>
166-
<plugin>
167-
<groupId>org.codehaus.mojo</groupId>
168-
<artifactId>findbugs-maven-plugin</artifactId>
169-
<version>3.0.5</version>
170-
</plugin>
171145
</plugins>
172146

173147
<pluginManagement>
@@ -194,26 +168,8 @@
194168
</archive>
195169
</configuration>
196170
</plugin>
197-
<plugin>
198-
<groupId>org.apache.maven.plugins</groupId>
199-
<artifactId>maven-release-plugin</artifactId>
200-
<version>3.1.1</version>
201-
<configuration>
202-
<autoVersionSubmodules>true</autoVersionSubmodules>
203-
<useReleaseProfile>true</useReleaseProfile>
204-
<releaseProfiles>release</releaseProfiles>
205-
<goals>deploy</goals>
206-
<tagNameFormat>v@{project.version}</tagNameFormat>
207-
</configuration>
208-
</plugin>
209171
</plugins>
210172
</pluginManagement>
211173
</build>
212174

213-
<distributionManagement>
214-
<snapshotRepository>
215-
<id>ossrh</id>
216-
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
217-
</snapshotRepository>
218-
</distributionManagement>
219175
</project>

0 commit comments

Comments
 (0)