Skip to content

Commit

Permalink
test deploy to maven central
Browse files Browse the repository at this point in the history
  • Loading branch information
bischoffz committed Mar 29, 2024
1 parent d72059e commit a3aa643
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 61 deletions.
22 changes: 16 additions & 6 deletions .github/workflows/release_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
branches: ["main"]

jobs:
create-release:
build-deploy:
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -28,9 +28,18 @@ jobs:
with:
java-version: '17'
distribution: 'temurin'

- name: Build Util
run: mvn clean install -Prelease --file pom.xml
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_SECRET_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Build and Deploy Util
run: mvn clean deploy -Pjavadoc,sign --file pom.xml
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_SECRET_KEY_PASSWORD }}

- name: Get Util Version
run: |
Expand All @@ -39,9 +48,10 @@ jobs:
- name: Make Util Release
uses: ncipollo/[email protected]
with:
artifacts: "target/util-${{ env.version }}*.jar"
prerelease: ${{ endsWith(env.version, 'SNAPSHOT') || contains(env.version, '-RC') }}
artifacts: "target/util-${{ env.version }}*"
name: "v${{ env.version }}"
tag: "v${{ env.version }}"
generateReleaseNotes: true
skipIfReleaseExists: true


2 changes: 1 addition & 1 deletion .github/workflows/release_pr_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
distribution: 'temurin'

- name: Build Util
run: mvn clean install --file pom.xml
run: mvn clean install -Pjavadoc,jacoco --file pom.xml

# 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
156 changes: 102 additions & 54 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<groupId>gov.hhs.aspr.ms</groupId>
<artifactId>util</artifactId>
<version>4.1.1</version>
<packaging>jar</packaging>
<packaging>jar</packaging>

<name>Modeling Utils</name>
<description>A suite of utility methods that are useful for simulation frameworks.</description>
Expand All @@ -20,6 +20,10 @@
<name>GNU GENERAL PUBLIC LICENSE v3</name>
<url>https://www.gnu.org/licenses/gpl-3.0.en.html</url>
</license>
<license>
<name>Vulnerability Disclosure Policy</name>
<url>https://www.hhs.gov/vulnerability-disclosure-policy/index.html</url>
</license>
</licenses>

<!-- Developers -->
Expand Down Expand Up @@ -51,11 +55,14 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<!-- <gpg.executable>gpg2</gpg.executable> -->
<gpg.useAgent>false</gpg.useAgent>

<!-- plugin versions -->
<maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>
<maven-source-plugin.version>3.3.0</maven-source-plugin.version>
<maven-javadoc-plugin.version>3.6.3</maven-javadoc-plugin.version>
<maven-gpg-plugin.version>3.2.2</maven-gpg-plugin.version>

<!-- dependency versions-->
<commons-math3.version>3.6.1</commons-math3.version>
Expand Down Expand Up @@ -111,57 +118,6 @@
</configuration>
</plugin>

<!-- Jacoco Coverage Check -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco-maven-plugin.version}</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>default-check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
<rule>
<element>BUNDLE</element>
<limits>
<limit>
<counter>LINE</counter>
<value>COVEREDRATIO</value>
<minimum>0.0</minimum>
</limit>
<limit>
<counter>BRANCH</counter>
<value>COVEREDRATIO</value>
<minimum>0.0</minimum>
</limit>
<limit>
<counter>INSTRUCTION</counter>
<value>COVEREDRATIO</value>
<minimum>0.0</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>

<!-- Attaches source jar to project -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -177,12 +133,23 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.4.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
<tokenAuth>true</tokenAuth>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>release</id>
<id>javadoc</id>
<build>
<plugins>
<!--Attaches javadoc jar to project -->
Expand Down Expand Up @@ -213,6 +180,87 @@
</plugins>
</build>
</profile>
<profile>
<id>sign</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${maven-gpg-plugin.version}</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
<configuration>
<useAgent>false</useAgent>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>jacoco</id>
<build>
<plugins>
<!-- Jacoco Coverage Check -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco-maven-plugin.version}</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>default-check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
<rule>
<element>BUNDLE</element>
<limits>
<limit>
<counter>LINE</counter>
<value>COVEREDRATIO</value>
<minimum>0.0</minimum>
</limit>
<limit>
<counter>BRANCH</counter>
<value>COVEREDRATIO</value>
<minimum>0.0</minimum>
</limit>
<limit>
<counter>INSTRUCTION</counter>
<value>COVEREDRATIO</value>
<minimum>0.0</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
</project>

0 comments on commit a3aa643

Please sign in to comment.