Skip to content

Commit 4964dfa

Browse files
committed
Working on publishing
1 parent 74aee83 commit 4964dfa

File tree

3 files changed

+71
-24
lines changed

3 files changed

+71
-24
lines changed
Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
1-
# Run the full CS ingration comparison
2-
#
3-
# This is just a proof of concept for now since the raw input is not available as it
4-
# is too large to include in repository.
5-
61
name: cs-comparison
72

83
on: workflow_dispatch
94

105
jobs:
116
build:
12-
137
runs-on: ubuntu-latest
148

159
steps:
@@ -19,11 +13,20 @@ jobs:
1913
- name: Set up JDK
2014
uses: actions/setup-java@v4
2115
with:
22-
distribution: 'adopt'
16+
distribution: 'temurin'
2317
java-version: '21'
24-
cache: 'gradle'
18+
cache: 'maven'
19+
20+
- name: Cache Maven packages
21+
uses: actions/cache@v4
22+
with:
23+
path: ~/.m2/repository
24+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
25+
restore-keys: |
26+
${{ runner.os }}-maven-
2527
26-
- name: CS Comparison
28+
- name: Build and run CS Comparison
2729
run: |
28-
chmod +x gradlew
29-
./gradlew :staging-client-java-cs:csIntegrationTest
30+
chmod +x ./mvnw
31+
./mvnw -B clean package -DskipTests
32+
./mvnw exec:java -Dexec.mainClass="com.imsweb.staging.cs.CsComparisonMain"

.github/workflows/publish.yml

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Publish to Maven Central
1+
# Publish to Maven Central (Maven)
22

33
name: publish
44

@@ -10,26 +10,41 @@ on:
1010

1111
jobs:
1212
publish:
13-
1413
runs-on: ubuntu-latest
1514

15+
permissions:
16+
contents: read
17+
1618
steps:
1719
- name: Checkout
1820
uses: actions/checkout@v4
1921

20-
- name: Set up JDK
22+
- name: Set up JDK 21 for Maven Central
2123
uses: actions/setup-java@v4
2224
with:
23-
distribution: 'adopt'
25+
distribution: 'temurin'
2426
java-version: '21'
25-
cache: 'gradle'
27+
cache: 'maven'
28+
29+
# Must match <id> in <distributionManagement>
30+
server-id: ossrh
31+
32+
# These are Maven properties in settings.xml; values come from env below
33+
server-username: MAVEN_CENTRAL_USERNAME
34+
server-password: MAVEN_CENTRAL_PASSWORD
2635

27-
- name: Publish to Maven Central (Portal)
28-
run: |
29-
chmod +x gradlew
30-
./gradlew publishAndReleaseToMavenCentral --no-configuration-cache
36+
# GPG setup (uses your in-memory private key)
37+
gpg-private-key: ${{ secrets.SIGNING_KEY }}
38+
39+
# Name of env var that holds the passphrase (see pom passphraseEnvName)
40+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
41+
42+
- name: Publish to Maven Central
43+
run: mvn -B -ntp clean deploy -P release -DskipTests
3144
env:
32-
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
33-
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
34-
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
35-
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
45+
# Sonatype / Central credentials
46+
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
47+
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
48+
49+
# GPG passphrase (referenced by MAVEN_GPG_PASSPHRASE name)
50+
MAVEN_GPG_PASSPHRASE: ${{ secrets.SIGNING_PASSWORD }}

pom.xml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,35 @@
272272
</plugins>
273273
</build>
274274

275+
<profiles>
276+
<profile>
277+
<!-- Only used when deploying signed artifacts -->
278+
<id>release</id>
279+
<build>
280+
<plugins>
281+
<plugin>
282+
<groupId>org.apache.maven.plugins</groupId>
283+
<artifactId>maven-gpg-plugin</artifactId>
284+
<version>3.2.7</version>
285+
<configuration>
286+
<bestPractices>true</bestPractices>
287+
<passphraseEnvName>MAVEN_GPG_PASSPHRASE</passphraseEnvName>
288+
</configuration>
289+
<executions>
290+
<execution>
291+
<id>sign-artifacts</id>
292+
<phase>verify</phase>
293+
<goals>
294+
<goal>sign</goal>
295+
</goals>
296+
</execution>
297+
</executions>
298+
</plugin>
299+
</plugins>
300+
</build>
301+
</profile>
302+
</profiles>
303+
275304
<distributionManagement>
276305
<snapshotRepository>
277306
<id>ossrh</id>

0 commit comments

Comments
 (0)