diff --git a/.github/workflows/maven-merge-build.yml b/.github/workflows/maven-merge-build.yml
index e190e1c..7d3415a 100644
--- a/.github/workflows/maven-merge-build.yml
+++ b/.github/workflows/maven-merge-build.yml
@@ -9,7 +9,7 @@
name: Java CI with Maven
on:
- push:
+ pull_request:
branches: [ "master" ]
jobs:
diff --git a/.github/workflows/publish-central.yml b/.github/workflows/publish-central.yml
index eaafd6c..d887b89 100644
--- a/.github/workflows/publish-central.yml
+++ b/.github/workflows/publish-central.yml
@@ -1,31 +1,90 @@
name: Publish package to the Maven Central Repository
on:
+ push:
+ branches: [ main, master ]
+ pull_request:
+ branches: [ main, master ]
release:
types: [ published ]
+ workflow_dispatch:
+ inputs:
+ version:
+ description: 'Version to deploy (optional, will use pom.xml version if not specified)'
+ required: false
+ type: string
jobs:
- release:
- name: Release on Sonatype OSS
+ build-and-test:
+ name: Build and Test
runs-on: ubuntu-latest
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: Set up JDK 17
+ uses: actions/setup-java@v4
+ with:
+ java-version: 17
+ distribution: 'temurin'
+
+ - name: Cache Maven packages
+ uses: actions/cache@v3
+ with:
+ path: ~/.m2
+ key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
+ restore-keys: ${{ runner.os }}-m2
+ - name: Build and test
+ run: mvn -B clean verify
+
+ - name: Upload test results
+ uses: actions/upload-artifact@v4
+ if: always()
+ with:
+ name: test-results
+ path: target/surefire-reports/
+ retention-days: 30
+
+ - name: Upload coverage reports
+ uses: actions/upload-artifact@v4
+ if: always()
+ with:
+ name: coverage-reports
+ path: target/site/jacoco/
+ retention-days: 30
+
+ publish:
+ name: Publish to Maven Central
+ runs-on: ubuntu-latest
+ needs: build-and-test
+ if: needs.build-and-test.result == 'success' && (github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'workflow_dispatch')
steps:
- - uses: actions/checkout@v2
+ - name: Checkout code
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
- name: Set up JDK 17
- uses: actions/setup-java@v2
+ uses: actions/setup-java@v4
with:
java-version: 17
- distribution: 'adopt'
+ distribution: 'temurin'
- - name: Build with Maven
- run: mvn -B package --file pom.xml
+ - name: Cache Maven packages
+ uses: actions/cache@v3
+ with:
+ path: ~/.m2
+ key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
+ restore-keys: ${{ runner.os }}-m2
- name: Set up Apache Maven Central
- uses: actions/setup-java@v2
+ uses: actions/setup-java@v4
with: # running setup-java again overwrites the settings.xml
java-version: 17
- distribution: 'adopt'
+ distribution: 'temurin'
server-id: ossrh
server-username: OSSRH_USERNAME
server-password: OSSRH_PASSWORD
@@ -33,8 +92,16 @@ jobs:
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Publish to Apache Maven Central
- run: mvn -Prelease deploy
+ run: mvn -B -Prelease deploy
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
+
+ - name: Create Release Tag
+ if: github.event_name == 'workflow_dispatch' && github.event.inputs.version != ''
+ run: |
+ git config --local user.email "action@github.com"
+ git config --local user.name "GitHub Action"
+ git tag -a v${{ github.event.inputs.version }} -m "Release version ${{ github.event.inputs.version }}"
+ git push origin v${{ github.event.inputs.version }}
diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml
index 45396b7..93b735f 100644
--- a/.github/workflows/release-build.yml
+++ b/.github/workflows/release-build.yml
@@ -1,9 +1,8 @@
# If the PR has the label release:major, release:minor, or release:patch, this will override bump_version_scheme.
# https://github.com/marketplace/actions/release-tag-new-action
-on:
- push:
- branches:
- - master
+on:
+ pull_request:
+ branches: [ "master" ]
jobs:
release-on-push:
diff --git a/pom.xml b/pom.xml
index 28f6bcb..a416cb9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
com.intuit.rwebpulse
rwebpulse
- 1.0.3
+ 1.0.4-SNAPSHOT
jar
Spring Web Client
https://github.com/intuit/rwebpulse
@@ -103,6 +103,17 @@
+
+ org.sonatype.central
+ central-publishing-maven-plugin
+ 0.8.0
+ true
+
+ central
+ true
+ published
+
+
org.jacoco
jacoco-maven-plugin
@@ -123,6 +134,57 @@
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 3.2.1
+
+
+ attach-sources
+ package
+
+ jar-no-fork
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 3.2.0
+
+
+ attach-javadocs
+ package
+
+ jar
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-gpg-plugin
+ 1.6
+
+
+ sign-artifacts
+ verify
+
+ sign
+
+
+
+
+
+ --pinentry-mode
+ loopback
+ --batch
+ --yes
+
+ false
+
+
@@ -162,7 +224,7 @@
1.6.7
true
- ossrh
+ central
https://oss.sonatype.org/
true
@@ -227,11 +289,11 @@
- ossrh
+ central
https://oss.sonatype.org/content/repositories/snapshots
- ossrh
+ central
https://oss.sonatype.org/service/local/staging/deploy/maven2/