Skip to content

Commit

Permalink
test publishing jars to github maven package repository
Browse files Browse the repository at this point in the history
  • Loading branch information
reimer-atb committed Jun 25, 2024
1 parent e11430d commit c2f72e8
Show file tree
Hide file tree
Showing 9 changed files with 117 additions and 109 deletions.
62 changes: 0 additions & 62 deletions .github/workflows/publish-container-image.yml

This file was deleted.

38 changes: 38 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: publish

on:
release:
types: [published]

jobs:
publish:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 11

- name: Cache Maven Packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('./**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Publish Packages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CONTAINER_REGISTRY_USERNAME: ${GITHUB_ACTOR}
CONTAINER_REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SMARTCLIDE_CONTEXT_GITLAB_API_TOKEN: ${{ secrets.GITLAB_DEV_SMARTCLIDE_EU_API_TOKEN }}
run: mvn --file pom.xml --batch-mode deploy -Djib.to.auth.username="${CONTAINER_REGISTRY_USERNAME}" -Djib.to.auth.password="${CONTAINER_REGISTRY_TOKEN}"
33 changes: 0 additions & 33 deletions .github/workflows/run-tests.yml

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: run-tests

on:
push

jobs:
test:

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 11

- name: Cache Maven Packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('./**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Run Tests
env:
SMARTCLIDE_CONTEXT_GITLAB_API_TOKEN: ${{ secrets.GITLAB_DEV_SMARTCLIDE_EU_API_TOKEN }}
run: mvn --file pom.xml --batch-mode test
14 changes: 7 additions & 7 deletions context-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.eclipse.opensmartclide.context</groupId>
<artifactId>parent</artifactId>
<version>2.0.0</version>
<version>2.0.1-SNAPSHOT</version>
</parent>

<artifactId>context-core</artifactId>
Expand Down Expand Up @@ -77,7 +77,7 @@
<version>2.0.7</version>
</dependency>

<!-- Apache CXF ! -->
<!-- Apache CXF -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
Expand All @@ -100,23 +100,23 @@
<artifactId>cxf-rt-transports-http-hc</artifactId>
<version>${cxf.version}</version>
</dependency>
<!-- end Apache CXF ! -->
<!-- end Apache CXF -->

<!-- SimpleXMLFramework ! -->
<!-- SimpleXMLFramework -->
<dependency>
<groupId>org.simpleframework</groupId>
<artifactId>simple-xml</artifactId>
<version>2.7.1</version>
</dependency>
<!-- End SimpleXMLFramework ! -->
<!-- End SimpleXMLFramework -->

<!-- JSON Support ! -->
<!-- JSON Support -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.11.0</version>
</dependency>
<!-- END_JSON Support ! -->
<!-- END_JSON Support -->

<dependency>
<groupId>org.projectlombok</groupId>
Expand Down
2 changes: 1 addition & 1 deletion context-extraction/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.eclipse.opensmartclide.context</groupId>
<artifactId>parent</artifactId>
<version>2.0.0</version>
<version>2.0.1-SNAPSHOT</version>
</parent>

<artifactId>context-extraction</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion context-monitoring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.eclipse.opensmartclide.context</groupId>
<artifactId>parent</artifactId>
<version>2.0.0</version>
<version>2.0.1-SNAPSHOT</version>
</parent>

<artifactId>context-monitoring</artifactId>
Expand Down
18 changes: 16 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>org.eclipse.opensmartclide.context</groupId>
<artifactId>parent</artifactId>
<version>2.0.0</version>
<version>2.0.1-SNAPSHOT</version>

<packaging>pom</packaging>

Expand All @@ -20,6 +20,14 @@
<url>https://www.atb-bremen.de</url>
</organization>

<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/eclipse-opensmartclide/smartclide-context</url>
</repository>
</distributionManagement>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.version>3.5.4</maven.version>
Expand Down Expand Up @@ -80,7 +88,8 @@
</extraExtensions>

<excludes>
<!--do not add license header to json files because json standard does not allow comments-->
<!--do not add license header to json files-->
<!--because the json standard does not allow comments-->
<exclude>**/*.json</exclude>
</excludes>

Expand Down Expand Up @@ -156,6 +165,11 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>3.3.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.2</version>
</plugin>
</plugins>
</pluginManagement>

Expand Down
24 changes: 21 additions & 3 deletions smartclide-monitoring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.eclipse.opensmartclide.context</groupId>
<artifactId>parent</artifactId>
<version>2.0.0</version>
<version>2.0.1-SNAPSHOT</version>
</parent>

<artifactId>smartclide-monitoring</artifactId>
Expand All @@ -23,7 +23,7 @@
<dependency>
<groupId>org.eclipse.opensmartclide.context</groupId>
<artifactId>context-monitoring</artifactId>
<version>2.0.0</version>
<version>2.0.1-SNAPSHOT</version>
</dependency>

<dependency>
Expand All @@ -35,16 +35,34 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<!--don't publish smartclide-specific module to maven package registry-->
<skip>true</skip>
</configuration>
</plugin>

<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>${jib-maven-plugin.version}</version>
<executions>
<execution>
<!--automatically build and push image during maven deploy phase-->
<phase>deploy</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
<configuration>
<from>
<image>eclipse-temurin:11.0.17_8-jre-jammy</image>
</from>
<to>
<image>ghcr.io/eclipse-opensmartclide/smartclide/${project.artifactId}:latest</image>
<image>ghcr.io/eclipse-opensmartclide/smartclide/${project.artifactId}:${project.version}</image>
</to>
<container>
<ports>
Expand Down

0 comments on commit c2f72e8

Please sign in to comment.