Skip to content

Commit

Permalink
modify maven.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
TingSty committed Aug 3, 2023
1 parent 05d2370 commit db84ef7
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 46 deletions.
63 changes: 40 additions & 23 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,46 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: maven
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.HIGHFLIP_GPG_SECRET_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Publish to the Maven Central Repository
run: |
mvn clean \
--no-transfer-progress \
--batch-mode \
-Prelease \
-DskipTests \
deploy --file pom.xml
env:
MAVEN_USERNAME: ${{ secrets.HIGHFLIP_MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.HIGHFLIP_MAVEN_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.HIGHFLIP_GPG_SECRET_KEY_PASSWORD }}
- name: Checkout project
uses: actions/checkout@v3

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
# cache: maven
# server-username: MAVEN_USERNAME
# server-password: MAVEN_PASSWORD
# gpg-private-key: ${{ secrets.HIGHFLIP_GPG_SECRET_KEY }}
# gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Build with Maven
run: mvn -B package -DskipTests -Prelease --file pom.xml

- name: Set up Apache Maven Central
uses: actions/setup-java@v3
with: # running setup-java again overwrites the settings.xml
java-version: '11'
distribution: 'temurin'
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
server-username: MAVEN_USERNAME # env variable for username in deploy
server-password: MAVEN_PASSWORD # env variable for token in deploy
gpg-private-key: ${{ secrets.HIGHFLIP_GPG_SECRET_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase

- name: Publish to the Maven Central Repository
run: |
mvn clean \
--no-transfer-progress \
--batch-mode \
-Prelease \
-DskipTests \
deploy --file pom.xml
env:
MAVEN_USERNAME: ${{ secrets.HIGHFLIP_MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.HIGHFLIP_MAVEN_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.HIGHFLIP_GPG_SECRET_KEY_PASSWORD }}

# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
# - name: Update dependency graph
Expand Down
36 changes: 13 additions & 23 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,6 @@
</developer>
</developers>

<distributionManagement>
<snapshotRepository>
<id>ossrh-snapshot</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<name>Central Repository OSSRH</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

<scm>
<url>https://github.com/baidu/highflip</url>
<connection>scm:git:git://github.com/baidu/highflip.git</connection>
Expand Down Expand Up @@ -237,6 +225,18 @@
<!-- mvn clean deploy -Prelease -->
<profile>
<id>release</id>
<distributionManagement>
<repository>
<id>ossrh</id>
<name>Central Repository OSSRH</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
<snapshotRepository>
<id>ossrh</id>
<name>Central Repository OSSRH</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -307,23 +307,13 @@
<version>${nexus.staging.maven.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<serverId>sonatype-nexus-repository</serverId>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>
<distributionManagement>
<snapshotRepository>
<id>sonatype-nexus-repository</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>sonatype-nexus-repository</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
</profile>
</profiles>
</project>

0 comments on commit db84ef7

Please sign in to comment.