Skip to content

Commit bd5cfd7

Browse files
adding jdk setup for snapshot
1 parent c8c2bfb commit bd5cfd7

File tree

2 files changed

+60
-12
lines changed

2 files changed

+60
-12
lines changed

.github/workflows/release.yml

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,60 @@ jobs:
1616
run: |
1717
echo "${{ secrets.MAVEN_GPG_PRIVATE_KEY }}" | gpg --batch --import
1818
echo 'pinentry-mode loopback' >> ~/.gnupg/gpg.conf
19-
20-
- name: Set up JDK
19+
20+
- name: Extract version from pom.xml
21+
id: get_version
22+
run: |
23+
version=$(xmllint --xpath "/*[local-name()='project']/*[local-name()='version']/text()" auto-generated-sdk/pom.xml)
24+
echo "version=$version" >> $GITHUB_OUTPUT
25+
if [[ "$version" == *SNAPSHOT* ]]; then
26+
echo "is_snapshot=true" >> $GITHUB_OUTPUT
27+
else
28+
echo "is_snapshot=false" >> $GITHUB_OUTPUT
29+
fi
30+
31+
- name: Set up JDK for snapshot repository
32+
if: steps.get_version.outputs.is_snapshot == 'true'
33+
uses: actions/setup-java@v4
34+
with:
35+
java-version: '8'
36+
distribution: 'temurin'
37+
server-id: central-portal-snapshots
38+
server-username: MAVEN_PORTAL_USERNAME
39+
server-password: MAVEN_CENTRAL_TOKEN
40+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
41+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
42+
43+
- name: Set up JDK for release repository
44+
if: steps.get_version.outputs.is_snapshot == 'false'
2145
uses: actions/setup-java@v4
2246
with:
2347
java-version: '8'
2448
distribution: 'temurin'
25-
server-id: central # Value of the distributionManagement/repository/id field of the pom.xml
26-
server-username: MAVEN_PORTAL_USERNAME # env variable for username in deploy
27-
server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy
28-
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
49+
server-id: central
50+
server-username: MAVEN_PORTAL_USERNAME
51+
server-password: MAVEN_CENTRAL_TOKEN
52+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
2953
gpg-passphrase: MAVEN_GPG_PASSPHRASE
54+
55+
# - name: Set up JDK
56+
# if: steps.get_version.outputs.is_snapshot == 'true'
57+
# uses: actions/setup-java@v4
58+
# with:
59+
# java-version: '8'
60+
# distribution: 'temurin'
61+
# server-id: central # Value of the distributionManagement/repository/id field of the pom.xml
62+
# server-username: MAVEN_PORTAL_USERNAME # env variable for username in deploy
63+
# server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy
64+
# gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
65+
# gpg-passphrase: MAVEN_GPG_PASSPHRASE
3066

3167
- name: Build with Maven
3268
run: mvn -B package --file auto-generated-sdk/pom.xml
3369

3470
- name: Publish to Apache Maven Central
35-
run: cd auto-generated-sdk && mvn verify deploy
71+
run: cd auto-generated-sdk && mvn -Psign-artifacts verify deploy
3672
env:
37-
MAVEN__PORTAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
73+
MAVEN_PORTAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
3874
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
3975
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

auto-generated-sdk/pom.xml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<url>https://github.com/factset/analyticsapi-engines-java-sdk</url>
1010
<description>SDK for FactSet Analytics Engines API</description>
1111
<distributionManagement>
12-
<repository>
12+
<snapshotRepository>
1313
<name>Central Portal Snapshots</name>
1414
<id>central-portal-snapshots</id>
1515
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
@@ -19,6 +19,14 @@
1919
<snapshots>
2020
<enabled>true</enabled>
2121
</snapshots>
22+
</snapshotRepository>
23+
<repository>
24+
<name>Central Portal Releases</name>
25+
<id>central</id>
26+
<url>https://central.sonatype.com</url>
27+
<releases>
28+
<enabled>true</enabled>
29+
</releases>
2230
</repository>
2331
</distributionManagement>
2432
<scm>
@@ -102,9 +110,6 @@
102110
<artifactId>central-publishing-maven-plugin</artifactId>
103111
<version>0.8.0</version>
104112
<extensions>true</extensions>
105-
<configuration>
106-
<publishingServerId>central</publishingServerId>
107-
</configuration>
108113
</plugin>
109114

110115
<!-- attach test jar -->
@@ -237,6 +242,13 @@
237242
</execution>
238243
</executions>
239244
</plugin>
245+
<plugin>
246+
<groupId>org.sonatype.central</groupId>
247+
<artifactId>central-publishing-maven-plugin</artifactId>
248+
<configuration>
249+
<publishingServerId>central</publishingServerId>
250+
</configuration>
251+
</plugin>
240252
</plugins>
241253
</build>
242254
</profile>

0 commit comments

Comments
 (0)