Skip to content

Commit a858119

Browse files
authored
chore(cicd): upload native artifacts to GitHub (#646)
1 parent 563a7c2 commit a858119

3 files changed

Lines changed: 122 additions & 82 deletions

File tree

.github/workflows/build.yml

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,17 @@ jobs:
8989
mvn -version
9090
echo "<settings><servers><server><id>central</id><username>${{ secrets.CI_DEPLOY_USERNAME }}</username><password>${{ secrets.CI_DEPLOY_PASSWORD }}</password></server></servers></settings>" > $HOME/.m2/settings.xml
9191
mvn clean install -pl '!tensorflow-framework' -B -U -e -Djavacpp.platform=${{ github.job }} -Djavacpp.platform.extension=${{ matrix.ext }}
92-
- name: Deploy native artifact
92+
- name: Build native artifact
9393
if: env.DEPLOY_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true'
94-
# run: mvn -f tensorflow-core/tensorflow-core-native/pom.xml deploy:deploy-file@native-only -B -e -Djavacpp.platform=${{ github.job }} -Djavacpp.platform.extension=${{ matrix.ext }} -Durl=${{ needs.prepare.outputs.repositoryUrl }}
9594
run: mvn -f tensorflow-core/tensorflow-core-native/pom.xml deploy -B -e -Djavacpp.platform=${{ github.job }} -Djavacpp.platform.extension=${{ matrix.ext }}
95+
- name: Upload native artifact
96+
if: env.DEPLOY_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true'
97+
uses: actions/upload-artifact@v4
98+
with:
99+
name: native-artifact-${{ github.job }}${{ matrix.ext }}
100+
path: tensorflow-core/tensorflow-core-native/target/*.zip
101+
if-no-files-found: error
102+
retention-days: 1
96103
linux-x86_64:
97104
runs-on: ubuntu-22.04
98105
needs: prepare
@@ -113,10 +120,17 @@ jobs:
113120
mvn -version
114121
echo "<settings><servers><server><id>central</id><username>${{ secrets.CI_DEPLOY_USERNAME }}</username><password>${{ secrets.CI_DEPLOY_PASSWORD }}</password></server></servers></settings>" > $HOME/.m2/settings.xml
115122
mvn clean install -pl '!tensorflow-framework' -B -U -e -Djavacpp.platform=${{ github.job }} -Djavacpp.platform.extension=${{ matrix.ext }}
116-
- name: Deploy native artifact
123+
- name: Build native artifact
117124
if: env.DEPLOY_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true'
118-
# run: mvn -f tensorflow-core/tensorflow-core-native/pom.xml deploy:deploy-file@native-only -B -e -Djavacpp.platform=${{ github.job }} -Djavacpp.platform.extension=${{ matrix.ext }} -Durl=${{ needs.prepare.outputs.repositoryUrl }}
119125
run: mvn -f tensorflow-core/tensorflow-core-native/pom.xml deploy -B -e -Djavacpp.platform=${{ github.job }} -Djavacpp.platform.extension=${{ matrix.ext }}
126+
- name: Upload native artifact
127+
if: env.DEPLOY_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true'
128+
uses: actions/upload-artifact@v4
129+
with:
130+
name: native-artifact-${{ github.job }}${{ matrix.ext }}
131+
path: tensorflow-core/tensorflow-core-native/target/*.zip
132+
if-no-files-found: error
133+
retention-days: 1
120134
macosx-arm64:
121135
runs-on: macos-14
122136
needs: prepare
@@ -138,10 +152,18 @@ jobs:
138152
mvn -version
139153
echo "<settings><servers><server><id>central</id><username>${{ secrets.CI_DEPLOY_USERNAME }}</username><password>${{ secrets.CI_DEPLOY_PASSWORD }}</password></server></servers></settings>" > $HOME/.m2/settings.xml
140154
mvn clean install -pl '!tensorflow-framework' -B -U -e -Djavacpp.platform=${{ github.job }} -Djavacpp.platform.extension=${{ matrix.ext }}
141-
- name: Deploy native artifact
155+
- name: Build native artifact
142156
if: env.DEPLOY_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true'
143-
# run: mvn -f tensorflow-core/tensorflow-core-native/pom.xml deploy:deploy-file@native-only -B -e -Djavacpp.platform=${{ github.job }} -Djavacpp.platform.extension=${{ matrix.ext }} -Durl=${{ needs.prepare.outputs.repositoryUrl }}
144157
run: mvn -f tensorflow-core/tensorflow-core-native/pom.xml deploy -B -e -Djavacpp.platform=${{ github.job }} -Djavacpp.platform.extension=${{ matrix.ext }}
158+
- name: Upload native artifact
159+
if: env.DEPLOY_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true'
160+
uses: actions/upload-artifact@v4
161+
with:
162+
name: native-artifact-${{ github.job }}${{ matrix.ext }}
163+
path: tensorflow-core/tensorflow-core-native/target/*.zip
164+
if-no-files-found: error
165+
retention-days: 1
166+
145167
deploy:
146168
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/staging') }} # DEPLOY_SNAPSHOT (releases should be signed and deployed manually from local machine)
147169
needs: [linux-x86_64, macosx-arm64, linux-arm64]
@@ -154,6 +176,12 @@ jobs:
154176
java-version: '11'
155177
- name: Checkout repository
156178
uses: actions/checkout@v6
179+
- name: Download native artifacts
180+
uses: actions/download-artifact@v8
181+
with:
182+
pattern: native-artifact-*
183+
path: tensorflow-core/tensorflow-core-native/target
184+
merge-multiple: true
157185
- name: Build project
158186
run: |
159187
java -version

pom.xml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -601,12 +601,6 @@
601601
<plugin>
602602
<groupId>org.sonatype.central</groupId>
603603
<artifactId>central-publishing-maven-plugin</artifactId>
604-
<version>0.10.0</version>
605-
<extensions>true</extensions>
606-
<configuration>
607-
<publishingServerId>central</publishingServerId>
608-
<ignorePublishedComponents>true</ignorePublishedComponents>
609-
</configuration>
610604
</plugin>
611605
</plugins>
612606

@@ -628,6 +622,15 @@
628622
<useModulePath>false</useModulePath>
629623
</configuration>
630624
</plugin>
625+
<plugin>
626+
<groupId>org.sonatype.central</groupId>
627+
<artifactId>central-publishing-maven-plugin</artifactId>
628+
<version>0.10.0</version>
629+
<extensions>true</extensions>
630+
<configuration>
631+
<publishingServerId>central</publishingServerId>
632+
</configuration>
633+
</plugin>
631634
</plugins>
632635
</pluginManagement>
633636
</build>

tensorflow-core/tensorflow-core-native/pom.xml

Lines changed: 79 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -85,51 +85,51 @@
8585
</properties>
8686
<build>
8787
<plugins>
88-
<plugin>
89-
<artifactId>maven-dependency-plugin</artifactId>
90-
<version>3.6.1</version>
91-
<executions>
92-
<execution>
93-
<id>copy-native-artifacts</id>
94-
<phase>validate</phase>
95-
<goals>
96-
<goal>copy</goal>
97-
</goals>
98-
<configuration>
99-
<outputDirectory>${project.build.directory}</outputDirectory>
100-
<overWriteSnapshots>true</overWriteSnapshots>
101-
<overWriteReleases>true</overWriteReleases>
102-
<useBaseVersion>true</useBaseVersion>
103-
<artifactItems>
104-
<artifactItem>
105-
<groupId>${project.groupId}</groupId>
106-
<artifactId>${project.artifactId}</artifactId>
107-
<version>${project.version}</version>
108-
<classifier>${javacpp.platform.linux-x86_64}</classifier>
109-
</artifactItem>
110-
<artifactItem>
111-
<groupId>${project.groupId}</groupId>
112-
<artifactId>${project.artifactId}</artifactId>
113-
<version>${project.version}</version>
114-
<classifier>${javacpp.platform.linux-x86_64}-gpu</classifier>
115-
</artifactItem>
116-
<artifactItem>
117-
<groupId>${project.groupId}</groupId>
118-
<artifactId>${project.artifactId}</artifactId>
119-
<version>${project.version}</version>
120-
<classifier>${javacpp.platform.macosx-arm64}</classifier>
121-
</artifactItem>
122-
<artifactItem>
123-
<groupId>${project.groupId}</groupId>
124-
<artifactId>${project.artifactId}</artifactId>
125-
<version>${project.version}</version>
126-
<classifier>${javacpp.platform.linux-arm64}</classifier>
127-
</artifactItem>
128-
</artifactItems>
129-
</configuration>
130-
</execution>
131-
</executions>
132-
</plugin>
88+
<!-- <plugin>-->
89+
<!-- <artifactId>maven-dependency-plugin</artifactId>-->
90+
<!-- <version>3.6.1</version>-->
91+
<!-- <executions>-->
92+
<!-- <execution>-->
93+
<!-- <id>copy-native-artifacts</id>-->
94+
<!-- <phase>validate</phase>-->
95+
<!-- <goals>-->
96+
<!-- <goal>copy</goal>-->
97+
<!-- </goals>-->
98+
<!-- <configuration>-->
99+
<!-- <outputDirectory>${project.build.directory}</outputDirectory>-->
100+
<!-- <overWriteSnapshots>true</overWriteSnapshots>-->
101+
<!-- <overWriteReleases>true</overWriteReleases>-->
102+
<!-- <useBaseVersion>true</useBaseVersion>-->
103+
<!-- <artifactItems>-->
104+
<!-- <artifactItem>-->
105+
<!-- <groupId>${project.groupId}</groupId>-->
106+
<!-- <artifactId>${project.artifactId}</artifactId>-->
107+
<!-- <version>${project.version}</version>-->
108+
<!-- <classifier>${javacpp.platform.linux-x86_64}</classifier>-->
109+
<!-- </artifactItem>-->
110+
<!-- <artifactItem>-->
111+
<!-- <groupId>${project.groupId}</groupId>-->
112+
<!-- <artifactId>${project.artifactId}</artifactId>-->
113+
<!-- <version>${project.version}</version>-->
114+
<!-- <classifier>${javacpp.platform.linux-x86_64}-gpu</classifier>-->
115+
<!-- </artifactItem>-->
116+
<!-- <artifactItem>-->
117+
<!-- <groupId>${project.groupId}</groupId>-->
118+
<!-- <artifactId>${project.artifactId}</artifactId>-->
119+
<!-- <version>${project.version}</version>-->
120+
<!-- <classifier>${javacpp.platform.macosx-arm64}</classifier>-->
121+
<!-- </artifactItem>-->
122+
<!-- <artifactItem>-->
123+
<!-- <groupId>${project.groupId}</groupId>-->
124+
<!-- <artifactId>${project.artifactId}</artifactId>-->
125+
<!-- <version>${project.version}</version>-->
126+
<!-- <classifier>${javacpp.platform.linux-arm64}</classifier>-->
127+
<!-- </artifactItem>-->
128+
<!-- </artifactItems>-->
129+
<!-- </configuration>-->
130+
<!-- </execution>-->
131+
<!-- </executions>-->
132+
<!-- </plugin>-->
133133
<plugin>
134134
<groupId>org.codehaus.mojo</groupId>
135135
<artifactId>build-helper-maven-plugin</artifactId>
@@ -565,32 +565,41 @@
565565
</executions>
566566
</plugin>
567567

568+
<!-- <plugin>-->
569+
<!-- <artifactId>maven-deploy-plugin</artifactId>-->
570+
<!-- <version>3.1.1</version>-->
571+
<!-- <executions>-->
572+
<!-- <execution>-->
573+
<!-- &lt;!&ndash;-->
574+
<!-- Deploy only native artifact-->
575+
<!-- This is used by the CI build to only deploy the native JAR artifact in the platform-specific runners.-->
576+
<!-- Other artifacts will be deployed in a second pass, when activating the `deploying` profile-->
577+
<!-- &ndash;&gt;-->
578+
<!-- <id>native-only</id>-->
579+
<!-- <goals>-->
580+
<!-- <goal>deploy-file</goal>-->
581+
<!-- </goals>-->
582+
<!-- <configuration>-->
583+
<!-- &lt;!&ndash; 'url' property must be provided in command line &ndash;&gt;-->
584+
<!-- <file>${project.build.directory}/${project.artifactId}-${project.version}-${native.classifier}.jar</file>-->
585+
<!-- <repositoryId>central</repositoryId>-->
586+
<!-- <groupId>${project.groupId}</groupId>-->
587+
<!-- <artifactId>${project.artifactId}</artifactId>-->
588+
<!-- <classifier>${native.classifier}</classifier>-->
589+
<!-- <pomFile>pom.xml</pomFile>-->
590+
<!-- <generatePom>false</generatePom>-->
591+
<!-- </configuration>-->
592+
<!-- </execution>-->
593+
<!-- </executions>-->
594+
<!-- </plugin>-->
595+
568596
<plugin>
569-
<artifactId>maven-deploy-plugin</artifactId>
570-
<version>3.1.1</version>
571-
<executions>
572-
<execution>
573-
<!--
574-
Deploy only native artifact
575-
This is used by the CI build to only deploy the native JAR artifact in the platform-specific runners.
576-
Other artifacts will be deployed in a second pass, when activating the `deploying` profile
577-
-->
578-
<id>native-only</id>
579-
<goals>
580-
<goal>deploy-file</goal>
581-
</goals>
582-
<configuration>
583-
<!-- 'url' property must be provided in command line -->
584-
<file>${project.build.directory}/${project.artifactId}-${project.version}-${native.classifier}.jar</file>
585-
<repositoryId>central</repositoryId>
586-
<groupId>${project.groupId}</groupId>
587-
<artifactId>${project.artifactId}</artifactId>
588-
<classifier>${native.classifier}</classifier>
589-
<pomFile>pom.xml</pomFile>
590-
<generatePom>false</generatePom>
591-
</configuration>
592-
</execution>
593-
</executions>
597+
<groupId>org.sonatype.central</groupId>
598+
<artifactId>central-publishing-maven-plugin</artifactId>
599+
<configuration>
600+
<skipPublishing>true</skipPublishing>
601+
<outputFilename>${project.artifactId}-${project.version}-${native.classifier}.zip</outputFilename>
602+
</configuration>
594603
</plugin>
595604

596605
<plugin>

0 commit comments

Comments
 (0)