Skip to content

Commit

Permalink
Update to Maven Central deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
jm-mailosaur committed Sep 30, 2024
1 parent 8868b27 commit 251ff10
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 61 deletions.
74 changes: 37 additions & 37 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ name: CI

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]
workflow_dispatch:

concurrency:
concurrency:
group: mailosaur-java
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ vars.LINUX }}
timeout-minutes: 10

env:
Expand All @@ -29,27 +29,27 @@ jobs:
MAILOSAUR_PREVIEWS_SERVER: ${{ secrets.MAILOSAUR_PREVIEWS_SERVER }}

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v3
with:
java-version: '8.0.332+9'
distribution: temurin
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Notify on Failure
uses: skitionek/notify-microsoft-teams@master
if: ${{ failure() }}
with:
webhook_url: ${{ secrets.TEAMS_BUILDS_WEBHOOK }}
needs: ${{ toJson(needs) }}
job: ${{ toJson(job) }}
overwrite: "{ title: `${workflow} failed for ${repository.name}` }"
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v4
with:
java-version: ${{ vars.JAVA_VERSION }}
distribution: temurin
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Notify on Failure
uses: skitionek/notify-microsoft-teams@master
if: ${{ failure() }}
with:
webhook_url: ${{ secrets.TEAMS_BUILDS_WEBHOOK }}
needs: ${{ toJson(needs) }}
job: ${{ toJson(job) }}
overwrite: "{ title: `${workflow} failed for ${repository.name}` }"

build-next:
if: ${{ always() }}
needs: build
runs-on: ubuntu-latest
runs-on: ${{ vars.LINUX }}
timeout-minutes: 10

env:
Expand All @@ -62,19 +62,19 @@ jobs:
MAILOSAUR_PREVIEWS_SERVER: ${{ secrets.MAILOSAUR_PREVIEWS_SERVER }}

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v3
with:
java-version: '8.0.332+9'
distribution: temurin
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Notify on Failure
uses: skitionek/notify-microsoft-teams@master
if: ${{ failure() }}
with:
webhook_url: ${{ secrets.TEAMS_BUILDS_WEBHOOK }}
needs: ${{ toJson(needs) }}
job: ${{ toJson(job) }}
overwrite: "{ title: `${workflow} failed for ${repository.name}` }"
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v4
with:
java-version: ${{ vars.JAVA_VERSION }}
distribution: temurin
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Notify on Failure
uses: skitionek/notify-microsoft-teams@master
if: ${{ failure() }}
with:
webhook_url: ${{ secrets.TEAMS_BUILDS_WEBHOOK }}
needs: ${{ toJson(needs) }}
job: ${{ toJson(job) }}
overwrite: "{ title: `${workflow} failed for ${repository.name}` }"
12 changes: 5 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
publish:
runs-on: ubuntu-latest
runs-on: ${{ vars.LINUX }}
timeout-minutes: 10

env:
Expand All @@ -21,13 +21,13 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '17'
java-version: ${{ vars.JAVA_VERSION }}
distribution: temurin
server-id: ossrh
server-username: MAVEN_USERNAME # env variable for username in deploy
server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy
server-username: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
server-password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
- name: Version
Expand All @@ -39,8 +39,6 @@ jobs:
run: |
mvn --batch-mode deploy
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: Notify on Failure
uses: skitionek/notify-microsoft-teams@master
Expand Down
21 changes: 4 additions & 17 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,27 +130,14 @@
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.6.0</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
<publishingServerId>central</publishingServerId>
</configuration>
</plugin>
</plugins>
</build>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
</project>

0 comments on commit 251ff10

Please sign in to comment.