Skip to content

Commit

Permalink
ci: add java package (#536)
Browse files Browse the repository at this point in the history
  • Loading branch information
sboukhetta authored Sep 11, 2024
2 parents d4baddc + fc0eaac commit 43cecbe
Show file tree
Hide file tree
Showing 7 changed files with 168 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -401,5 +401,9 @@ jobs:
distribution: oracle
java-version: 17
cache: maven
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Build the package
run: mvn clean install -DskipTests
env:
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_SIGNING_KEY_PASSWORD }}
26 changes: 26 additions & 0 deletions .github/workflows/publish-edge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,29 @@ jobs:
path: packages/cpp/tools/packaging/*.${{ matrix.type }}
name: libarmonik.${{ matrix.type }}
# TODO Upload to a more permanent storage

release-java-package:
needs: [version]
name: Release Java Package
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/java
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Set up Maven Central Repository
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: temurin
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Publish package
run: mvn --batch-mode deploy versions:set -DnewVersion=${{ needs.version.outputs.version }}
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_SIGNING_KEY_PASSWORD }}
24 changes: 24 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,30 @@ jobs:
run: |
gh release upload ${{ github.ref_name }} packages/cpp/tools/packaging/*.${{ matrix.type }}
release-java-package:
needs: [verify-versions]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Set up Maven Central Repository
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: temurin
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Publish package
run: |
cd packages/java
mvn --batch-mode deploy -DskipTests
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_SIGNING_KEY_PASSWORD }}

update-changelog:
needs: [verify-versions]
runs-on: ubuntu-latest
Expand Down
105 changes: 102 additions & 3 deletions packages/java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,43 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.aneo</groupId>
<groupId>fr.aneo</groupId>
<artifactId>armonik-java</artifactId>
<description>GRPC java binding for the Armonik orchestrator API</description>
<version>0.1.0</version>
<version>3.21.0</version>

<name>armonik-java</name>
<url>https://github.com/aneoconsulting/ArmoniK.Api</url>

<developers>
<developer>
<name>Junior DONGO</name>
<email>[email protected]</email>
</developer>
<developer>
<name>Hassan EL-MZABI</name>
<email>[email protected]</email>
</developer>
<developer>
<name>Salah Eddine BOUKHETTA</name>
<email>[email protected]</email>
</developer>
</developers>

<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/</url>
<distribution>repo</distribution>
</license>
</licenses>

<scm>
<url>https://github.com/aneoconsulting/ArmoniK.Api</url>
<connection>scm:git:https://github.com/aneoconsulting/ArmoniK.Api.git</connection>
<developerConnection>scm:git:https://github.com/aneoconsulting/ArmoniK.Api.git</developerConnection>
<tag>HEAD</tag>
</scm>

<properties>
<maven.compiler.source>17</maven.compiler.source>
Expand Down Expand Up @@ -131,7 +164,73 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.17.1</version>
</plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.5.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
<tokenAuth>true</tokenAuth>
<autoPublish>true</autoPublish>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.6.3</version>
<executions>
<execution>
<id>attach-javadoc</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<stylesheet>java</stylesheet>
<doclint>none</doclint>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</plugin>
</plugins>
</build>

</project>
5 changes: 5 additions & 0 deletions scripts/update-versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
csharpFiles,
csharpPatternPackageVersion,
csharpPatternVersion,
javaFiles,
javaPattern,
jsFiles,
jsPattern,
} from './versions/_contants'
Expand Down Expand Up @@ -36,3 +38,6 @@ jsFiles.forEach(_readAndReplace(jsPattern, `"version": "${version}"`))

consola.info('Updating cpp projects to ', version)
cppFiles.forEach(_readAndReplace(cppPattern, `set(version ${version})`))

consola.info('Updating java projects to ', version)
javaFiles.forEach(_readAndReplace(javaPattern, `<version>${version}</version>`))
4 changes: 4 additions & 0 deletions scripts/verify-versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
csharpFiles,
csharpPatternPackageVersion,
csharpPatternVersion,
javaFiles,
javaPattern,
jsFiles,
jsPattern,
} from './versions/_contants'
Expand All @@ -22,6 +24,8 @@ consola.info('Finding C# <Version> projects versions')
csharpFiles.forEach(_readAndFind(csharpPatternVersion, versions))
consola.info('Finding Cpp projects versions')
cppFiles.forEach(_readAndFind(cppPattern, versions))
consola.info('Finding java projects versions')
javaFiles.forEach(_readAndFind(javaPattern, versions))

const versionsArray = [...versions.values()]
const uniqueVersions = [...new Set(versionsArray)]
Expand Down
3 changes: 3 additions & 0 deletions scripts/versions/_contants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ export const jsFiles = ['packages/angular/projects/aneoconsultingfr/armonik.api.

export const cppPattern = /set\(version (?<version>.*)\)/
export const cppFiles = ['packages/cpp/CMakeLists.txt']

export const javaPattern = /<version>(?<version>.*)<\/version>/
export const javaFiles = ['packages/java/pom.xml']

0 comments on commit 43cecbe

Please sign in to comment.