Skip to content

Commit

Permalink
fix-ci (#4)
Browse files Browse the repository at this point in the history
* create maven profiles, use ci profile for release, include getting and creating proto files for local profile only
  • Loading branch information
mladjan-gadzic authored Dec 23, 2024
1 parent fb8ce51 commit 7df0fe2
Show file tree
Hide file tree
Showing 2 changed files with 148 additions and 122 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
run: |
cp settings.xml /home/runner/.m2
cat /home/runner/.m2/settings.xml
mvn clean install -DskipTests
mvn clean install
env:
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

Expand All @@ -37,7 +37,7 @@ jobs:
pwd
ls -la /home/runner/.m2
cat /home/runner/.m2/settings.xml
mvn --batch-mode deploy -DskipTests
mvn --batch-mode deploy -DskipTests -Pci
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
Expand Down
266 changes: 146 additions & 120 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@

<scm>
<connection>scm:git:git://github.com/armadaproject/java-client.git</connection>
<developerConnection>scm:git:ssh://github.com:armadaproject/java-client.git</developerConnection>
<developerConnection>scm:git:ssh://github.com:armadaproject/java-client.git
</developerConnection>
<url>http://github.com/armadaproject/java-client/tree/main</url>
<tag/>
</scm>
Expand All @@ -58,6 +59,150 @@
</repository>
</distributionManagement>

<profiles>
<profile>
<id>local</id>
<properties>
<env>local</env>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<!-- get proto files -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${exec-maven-plugin.version}</version>
<executions>
<execution>
<id>clone-armada-repo</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>git</executable>
<arguments>
<argument>clone</argument>
<argument>https://github.com/armadaproject/armada.git</argument>
<argument>${project.build.directory}/armada</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>clone-api-repo</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>git</executable>
<arguments>
<argument>clone</argument>
<argument>https://github.com/kubernetes/api.git</argument>
<argument>${project.build.directory}/k8s.io/api</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>clone-apimachinery-repo</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>git</executable>
<arguments>
<argument>clone</argument>
<argument>https://github.com/kubernetes/apimachinery.git</argument>
<argument>${project.build.directory}/k8s.io/apimachinery</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>

<!-- copy proto files -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>${maven-resources-plugin.version}</version>
<executions>
<execution>
<id>copy-protos</id>
<phase>generate-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/src/main/proto</outputDirectory>
<resources>
<resource>
<directory>${project.build.directory}/armada</directory>
<includes>
<include>pkg/api/*.proto</include>
<include>pkg/api/binoculars/*.proto</include>
</includes>
</resource>
<resource>
<directory>${project.build.directory}</directory>
<includes>
<include>k8s.io/api/core/v1/generated.proto</include>
<include>k8s.io/api/networking/v1/generated.proto</include>
<include>k8s.io/apimachinery/pkg/api/resource/generated.proto</include>
<include>k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto</include>
<include>k8s.io/apimachinery/pkg/runtime/generated.proto</include>
<include>k8s.io/apimachinery/pkg/runtime/schema/generated.proto</include>
<include>k8s.io/apimachinery/pkg/util/intstr/generated.proto</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>ci</id>
<properties>
<env>ci</env>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.6.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
<autoPublish>true</autoPublish>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.2.7</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<build>
<plugins>
<!-- detect os -->
Expand All @@ -74,99 +219,6 @@
</executions>
</plugin>

<!-- get proto files -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${exec-maven-plugin.version}</version>
<executions>
<execution>
<id>clone-armada-repo</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>git</executable>
<arguments>
<argument>clone</argument>
<argument>https://github.com/armadaproject/armada.git</argument>
<argument>${project.build.directory}/armada</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>clone-api-repo</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>git</executable>
<arguments>
<argument>clone</argument>
<argument>https://github.com/kubernetes/api.git</argument>
<argument>${project.build.directory}/k8s.io/api</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>clone-apimachinery-repo</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>git</executable>
<arguments>
<argument>clone</argument>
<argument>https://github.com/kubernetes/apimachinery.git</argument>
<argument>${project.build.directory}/k8s.io/apimachinery</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>

<!-- copy proto files -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>${maven-resources-plugin.version}</version>
<executions>
<execution>
<id>copy-protos</id>
<phase>generate-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/src/main/proto</outputDirectory>
<resources>
<resource>
<directory>${project.build.directory}/armada</directory>
<includes>
<include>pkg/api/*.proto</include>
<include>pkg/api/binoculars/*.proto</include>
</includes>
</resource>
<resource>
<directory>${project.build.directory}</directory>
<includes>
<include>k8s.io/api/core/v1/generated.proto</include>
<include>k8s.io/api/networking/v1/generated.proto</include>
<include>k8s.io/apimachinery/pkg/api/resource/generated.proto</include>
<include>k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto</include>
<include>k8s.io/apimachinery/pkg/runtime/generated.proto</include>
<include>k8s.io/apimachinery/pkg/runtime/schema/generated.proto</include>
<include>k8s.io/apimachinery/pkg/util/intstr/generated.proto</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>

<!-- compile java -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -231,32 +283,6 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.6.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
<autoPublish>true</autoPublish>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.2.7</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down

0 comments on commit 7df0fe2

Please sign in to comment.