Skip to content

Commit

Permalink
Merge pull request #4 from CDCgov/testm
Browse files Browse the repository at this point in the history
Updated the pipeline to push to github repo and Maven Central
  • Loading branch information
marcia-schulman authored Aug 30, 2024
2 parents c2712a4 + 9e0e127 commit 1e6b90e
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 5 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/deploy-to-github.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Deploy Maven Packages
on:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: temurin

- name: Publish Package - lib-hl7v2-nist
run: mvn -B package

- name: Deploy to Github Packages
run: mvn deploy --settings .github/workflows/mvn-settings.xml
env:
LIB_GITHUB_ACTOR: '${{ secrets.LIB_GITHUB_ACTOR }}'
LIB_GITHUB_TOKEN: '${{ secrets.LIB_GITHUB_TOKEN }}'
38 changes: 38 additions & 0 deletions .github/workflows/deploy-to-maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Java/maven CI/CD Pipeline
on:
push:
tags:
- 'v*.*.*' # Adjust the tag pattern to match your versioning scheme
release:
types: [created] # Trigger the workflow when a release is created

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Decrypt and Import GPG Key
run: |
gpgconf --kill gpg-agent || true
gpgconf --launch gpg-agent || true
echo "$GPG_PRIVATE_KEY" | gpg --batch --no-tty --import
env:
GPG_PRIVATE_KEY: '${{ secrets.GPG_PRIVATE_KEY }}'
GPG_PASSPHRASE: '${{ secrets.GPG_PASSPHRASE }}'

- name: Publish to Maven Central
env:
SONATYPE_USERNAME: '${{ secrets.SONATYPE_USERNAME }}'
SONATYPE_PASSWORD: '${{ secrets.SONATYPE_PASSWORD }}'
GPG_PASSPHRASE: '${{ secrets.GPG_PASSPHRASE }}'
run: mvn -B clean deploy --settings .github/workflows/mvn-settings.xml
18 changes: 15 additions & 3 deletions .github/workflows/mvn-settings.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0">
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>central</id>
<username>${env.SONATYPE_USERNAME}</username>
<password>${env.SONATYPE_PASSWORD}</password>
</server>
<server>
<id>gpg.passphrase</id>
<passphrase>${env.GPG_PASSPHRASE}</passphrase>
</server>
<server>
<id>github</id>
<username>${env.LIB_GITHUB_ACTOR}</username>
<password>${env.LIB_GITHUB_TOKEN}</password>
</server>
</servers>
</settings>
</servers>
</settings>
45 changes: 43 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<artifactId>lib-hl7v2-nist-validator</artifactId>
<name>lib-hl7v2-nist-validator</name>
<description>Library wrapper around NIST HL7v2 Validator for validation of HL7 v2.x messages.</description>
<version>1.3.5</version>
<version>1.3.7</version>
<packaging>jar</packaging>
<url>https://github.com/CDCgov/lib-hl7v2-nist-validator</url>
<licenses>
Expand Down Expand Up @@ -39,14 +39,54 @@
</repository>
</distributionManagement>

<url>https://github.com/CDCgov/lib-hl7v2-nist-validator</url>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<developers>
<developer>
<name>Marcelo Caldas</name>
<email>[email protected]</email>
<organization>CDC</organization>
<organizationUrl>https://www.cdc.gov/</organizationUrl>
</developer>
<developer>
<name>Marcia Schulman</name>
<email>[email protected]</email>
<organization>CDC</organization>
<organizationUrl>https://www.cdc.gov</organizationUrl>
</developer>
</developers>
<scm>
<connection>scm:git:git://github.com/CDCgov/lib-hl7v2-nist-validator.git</connection>
<developerConnection>scm:git:ssh://github.com/CDCgov/lib-hl7v2-nist-validator.git</developerConnection>
<url>https://github.com/CDCgov/lib-hl7v2-nist-validator/tree/main</url>
</scm>
<distributionManagement>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/cdcgov/lib-hl7v2-nist-validator</url>
</repository>
</distributionManagement>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>17</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<kotlin.version>1.9.0</kotlin.version>
<nist.version>1.6.3</nist.version>
</properties>
<repositories>
<repository>
<id>hit-nexus</id>
<url>https://hit-nexus.nist.gov/repository/releases</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -78,7 +118,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<version>3.2.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
Expand Down Expand Up @@ -256,4 +296,5 @@
</dependency>
</dependencies>


</project>

0 comments on commit 1e6b90e

Please sign in to comment.