Skip to content

Commit b846414

Browse files
authored
upgrade workflow files from mvn_01 (#70)
* upgrade workflow files from mvn_01 * update release profiles to pom.xml
1 parent e770cc1 commit b846414

3 files changed

Lines changed: 79 additions & 73 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Upload Release to GitHub Packages
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
upload:
9+
name: Upload
10+
runs-on: ubuntu-latest
11+
permissions:
12+
packages: write
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Cache Local Maven Repository
20+
uses: actions/cache@v4
21+
with:
22+
path: ~/.m2/repository
23+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
24+
25+
- name: Setup Signing
26+
uses: actions/setup-java@v4
27+
with:
28+
java-version: 8.0.292+10
29+
distribution: 'adopt'
30+
31+
- name: Setup GitHub Packages
32+
uses: actions/setup-java@v4
33+
with:
34+
java-version: 8.0.292+10
35+
distribution: 'adopt'
36+
37+
- name: Publish to GitHub Packages
38+
run: mvn --batch-mode -Drevision=${{ github.event.release.tag_name }} -Dsha1= -Dchangelist= clean deploy -Ppublish-github-packages
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,48 @@
1-
name: Upload Release
1+
name: Upload Release to Maven Central
22

33
on:
44
release:
5-
types: published
5+
types: [published]
66

77
jobs:
88
upload:
99
name: Upload
1010
runs-on: ubuntu-latest
11+
if: ${{ startsWith(github.repository, 'teragrep/') }}
1112

1213
steps:
13-
- uses: actions/checkout@v2
14-
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
1518
- name: Cache Local Maven Repository
16-
uses: actions/cache@v2
19+
uses: actions/cache@v4
1720
with:
1821
path: ~/.m2/repository
1922
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
2023

21-
- name: Setup Maven Central
22-
uses: actions/setup-java@v2
24+
- name: Setup Signing
25+
uses: actions/setup-java@v4
2326
with:
2427
java-version: 8.0.292+10
2528
distribution: 'adopt'
29+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
30+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
2631

27-
server-id: ossrh
28-
server-username: MAVEN_CENTRAL_USERNAME
29-
server-password: MAVEN_CENTRAL_TOKEN
32+
- name: Setup Maven Central
33+
uses: actions/setup-java@v4
34+
with:
35+
java-version: 8.0.292+10
36+
distribution: 'adopt'
3037

31-
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
38+
server-id: central-sonatype-org
39+
server-username: CENTRAL_SONATYPE_ORG_USERNAME
40+
server-password: CENTRAL_SONATYPE_ORG_PASSWORD
3241
gpg-passphrase: MAVEN_GPG_PASSPHRASE
3342

3443
- name: Publish to Maven Central
3544
run: mvn --batch-mode -Drevision=${{ github.event.release.tag_name }} -Dsha1= -Dchangelist= clean deploy -Ppublish-maven-central
3645
env:
37-
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
38-
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
39-
46+
CENTRAL_SONATYPE_ORG_USERNAME: ${{ secrets.CENTRAL_SONATYPE_ORG_USERNAME }}
47+
CENTRAL_SONATYPE_ORG_PASSWORD: ${{ secrets.CENTRAL_SONATYPE_ORG_PASSWORD }}
4048
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
41-
42-
- name: Setup GitHub Packages
43-
uses: actions/setup-java@v2
44-
with:
45-
java-version: 8.0.292+10
46-
distribution: 'adopt'
47-
48-
- name: Publish to GitHub Packages
49-
run: mvn --batch-mode -Drevision=${{ github.event.release.tag_name }} -Dsha1= -Dchangelist= clean deploy -Ppublish-github-packages
50-
env:
51-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

pom.xml

Lines changed: 17 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -476,33 +476,23 @@
476476
</plugins>
477477
</build>
478478
<profiles>
479-
<profile>
480-
<id>dev</id>
481-
<activation>
482-
<activeByDefault>false</activeByDefault>
483-
</activation>
484-
<properties>
485-
<maven.compiler.release>8</maven.compiler.release>
486-
</properties>
487-
</profile>
488-
<profile>
489-
<id>dev-java-8</id>
490-
</profile>
479+
<!-- Required when publishing to Maven Central -->
491480
<profile>
492481
<id>publish-maven-central</id>
493-
<distributionManagement>
494-
<repository>
495-
<id>ossrh</id>
496-
<name>Central Repository OSSRH</name>
497-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
498-
</repository>
499-
<snapshotRepository>
500-
<id>ossrh</id>
501-
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
502-
</snapshotRepository>
503-
</distributionManagement>
504482
<build>
505483
<plugins>
484+
<plugin>
485+
<groupId>org.sonatype.central</groupId>
486+
<artifactId>central-publishing-maven-plugin</artifactId>
487+
<version>0.5.0</version>
488+
<extensions>true</extensions>
489+
<configuration>
490+
<publishingServerId>central-sonatype-org</publishingServerId>
491+
<tokenAuth>true</tokenAuth>
492+
<autoPublish>true</autoPublish>
493+
<waitUntil>validated</waitUntil>
494+
</configuration>
495+
</plugin>
506496
<plugin>
507497
<groupId>org.apache.maven.plugins</groupId>
508498
<artifactId>maven-gpg-plugin</artifactId>
@@ -526,39 +516,18 @@
526516
</plugins>
527517
</build>
528518
</profile>
519+
<!-- /Required when publishing to Maven Central -->
520+
<!-- Required when publishing to GitHub Packages -->
529521
<profile>
530522
<id>publish-github-packages</id>
531523
<distributionManagement>
532524
<repository>
533525
<id>github</id>
534526
<name>GitHub Packages</name>
535-
<url>https://maven.pkg.github.com/teragrep/rlo_06</url>
527+
<url>https://maven.pkg.github.com/${env.GITHUB_REPOSITORY}</url>
536528
</repository>
537529
</distributionManagement>
538-
<build>
539-
<plugins>
540-
<plugin>
541-
<groupId>org.apache.maven.plugins</groupId>
542-
<artifactId>maven-gpg-plugin</artifactId>
543-
<version>1.6</version>
544-
<executions>
545-
<execution>
546-
<id>sign-artifacts</id>
547-
<goals>
548-
<goal>sign</goal>
549-
</goals>
550-
<phase>verify</phase>
551-
<configuration>
552-
<gpgArguments>
553-
<arg>--pinentry-mode</arg>
554-
<arg>loopback</arg>
555-
</gpgArguments>
556-
</configuration>
557-
</execution>
558-
</executions>
559-
</plugin>
560-
</plugins>
561-
</build>
562530
</profile>
531+
<!-- Required when publishing to GitHub Packages -->
563532
</profiles>
564533
</project>

0 commit comments

Comments
 (0)