diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5b8cc3316f6..0b76b8ddd62 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,6 +12,8 @@ on: types: [opened, reopened, synchronize, labeled, unlabeled] env: STAGING_PROFILE_ID: 46f80d0729c92d + IS_SNAPSHOT: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/staging') + IS_RELEASE: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/r') jobs: check-format: if: github.event_name == 'pull_request' @@ -35,10 +37,10 @@ jobs: prepare: runs-on: ubuntu-20.04 outputs: - stagingRepositoryId: ${{ steps.staging.outputs.stagingRepositoryId }} + repositoryUrl: ${{ steps.repository.outputs.repositoryUrl }} steps: - name: Create staging repository - if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/r') + if: ${{ IS_RELEASE }} id: staging run: | echo "Creating staging repository with profile $STAGING_PROFILE_ID" @@ -47,7 +49,17 @@ jobs: https://oss.sonatype.org/service/local/staging/profiles/$STAGING_PROFILE_ID/start STAGING_REPOSITORY_ID=`awk -F'[<>]' '/stagedRepositoryId/{print $3}' response.xml` echo "Staging repository created: $STAGING_REPOSITORY_ID" - echo "::set-output name=stagingRepositoryId::$STAGING_REPOSITORY_ID" + - name: Extract repository URL + id: repository + run: | + if [[ "${{ IS_RELEASE }}" ]]; then + export URL_PROPERTY="project.distributionManagement.repository.url" + else + export URL_PROPERTY="project.distributionManagement.snapshotRepository.url" + fi + REPOSITORY_URL=`mvn exec:exec -q -N -Dexec.executable='echo' -Dexec.args="\${$URL_PROPERTY}" -DstagingRepositoryId=$STAGING_REPOSITORY_ID` + echo "Repository URL: $REPOSITORY_URL" + echo "::set-output name=repositoryUrl::$REPOSITORY_URL" linux-x86_64: runs-on: ubuntu-20.04 needs: prepare @@ -67,7 +79,10 @@ jobs: gcc --version mvn -version echo "ossrh${{ secrets.CI_DEPLOY_USERNAME }}${{ secrets.CI_DEPLOY_PASSWORD }}" > $HOME/.m2/settings.xml - mvn clean install -pl '!tensorflow-framework' -B -U -e -Djavacpp.platform=linux-x86_64 -Djavacpp.platform.extension=${{ matrix.ext }} -am -DstagingRepositoryId=${{ needs.prepare.outputs.stagingRepositoryId }} + mvn clean install -pl '!tensorflow-framework' -B -U -e -Djavacpp.platform=linux-x86_64 -Djavacpp.platform.extension=${{ matrix.ext }} -am + - name: Deploy native artifact + if: ${{ IS_RELEASE }} || ${{ IS_SNAPSHOT }} + run: mvn -f tensorflow-core/tensorflow-core-native/pom.xml deploy:deploy-file@native-only -Durl=${{ needs.prepare.outputs.repositoryUrl }} macosx-arm64: runs-on: macos-14 needs: prepare @@ -88,7 +103,10 @@ jobs: clang --version mvn -version echo "ossrh${{ secrets.CI_DEPLOY_USERNAME }}${{ secrets.CI_DEPLOY_PASSWORD }}" > $HOME/.m2/settings.xml - mvn clean install -pl '!tensorflow-framework' -B -U -e -Djavacpp.platform=macosx-arm64 -Djavacpp.platform.extension=${{ matrix.ext }} -am -DstagingRepositoryId=${{ needs.prepare.outputs.stagingRepositoryId }} + mvn clean install -pl '!tensorflow-framework' -B -U -e -Djavacpp.platform=macosx-arm64 -Djavacpp.platform.extension=${{ matrix.ext }} -am + - name: Deploy native artifact + if: ${{ IS_RELEASE }} || ${{ IS_SNAPSHOT }} + run: mvn -f tensorflow-core/tensorflow-core-native/pom.xml deploy:deploy-file@native-only -Durl=${{ needs.prepare.outputs.repositoryUrl }} macosx-x86_64: runs-on: macos-11 needs: prepare @@ -108,7 +126,10 @@ jobs: clang --version mvn -version echo "ossrh${{ secrets.CI_DEPLOY_USERNAME }}${{ secrets.CI_DEPLOY_PASSWORD }}" > $HOME/.m2/settings.xml - mvn clean install -pl '!tensorflow-framework' -B -U -e -Djavacpp.platform=macosx-x86_64 -Djavacpp.platform.extension=${{ matrix.ext }} -am -DstagingRepositoryId=${{ needs.prepare.outputs.stagingRepositoryId }} + mvn clean install -pl '!tensorflow-framework' -B -U -e -Djavacpp.platform=macosx-x86_64 -Djavacpp.platform.extension=${{ matrix.ext }} -am + - name: Deploy native artifact + if: ${{ IS_RELEASE }} || ${{ IS_SNAPSHOT }} + run: mvn -f tensorflow-core/tensorflow-core-native/pom.xml deploy:deploy-file@native-only -Durl=${{ needs.prepare.outputs.repositoryUrl }} windows-x86_64: if: github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'CI build') runs-on: windows-2019 @@ -148,10 +169,13 @@ jobs: call mvn -version echo ^^^^ossrh^^${{ secrets.CI_DEPLOY_USERNAME }}^^${{ secrets.CI_DEPLOY_PASSWORD }}^^^^ > %USERPROFILE%\.m2\settings.xml set "SKIP_EXPORT=true" - call mvn clean install -pl "!tensorflow-framework" -B -U -e -Djavacpp.platform=windows-x86_64 -Djavacpp.platform.extension=${{ matrix.ext }} -am -DstagingRepositoryId=${{ needs.prepare.outputs.stagingRepositoryId }} + call mvn clean install -pl "!tensorflow-framework" -B -U -e -Djavacpp.platform=windows-x86_64 -Djavacpp.platform.extension=${{ matrix.ext }} -am if ERRORLEVEL 1 exit /b + - name: Deploy native artifact + if: ${{ IS_RELEASE }} || ${{ IS_SNAPSHOT }} + run: mvn -f tensorflow-core/tensorflow-core-native/pom.xml deploy:deploy-file@native-only -Durl=${{ needs.prepare.outputs.repositoryUrl }} deploy: - if: github.event_name == 'push' && (contains(github.ref, 'master') || contains(github.ref, 'staging')) + if: false # ${{ IS_SNAPSHOT }} needs: [linux-x86_64, macosx-x86_64, windows-x86_64, macosx-arm64] runs-on: ubuntu-20.04 steps: diff --git a/pom.xml b/pom.xml index 6eb3dd2c328..fa8bed7ed56 100644 --- a/pom.xml +++ b/pom.xml @@ -148,6 +148,7 @@ false + deploying diff --git a/tensorflow-core/tensorflow-core-api/pom.xml b/tensorflow-core/tensorflow-core-api/pom.xml index 0bbaa047aa7..7a78ba78460 100644 --- a/tensorflow-core/tensorflow-core-api/pom.xml +++ b/tensorflow-core/tensorflow-core-api/pom.xml @@ -177,18 +177,6 @@ - - - - deploying - - true - - diff --git a/tensorflow-core/tensorflow-core-native/pom.xml b/tensorflow-core/tensorflow-core-native/pom.xml index 75c2914f5b7..750630b3661 100644 --- a/tensorflow-core/tensorflow-core-native/pom.xml +++ b/tensorflow-core/tensorflow-core-native/pom.xml @@ -58,6 +58,7 @@ + native-build @@ -73,13 +74,18 @@ + + + deploying + + true + true + + + + generating - - - native.generate - - false false @@ -467,6 +473,34 @@ + + maven-deploy-plugin + 3.1.1 + + + + native-only + + deploy-file + + + + ${project.build.directory}/${project.artifactId}-${project.version}-${native.classifier}.jar + ossrh + ${project.groupId} + ${project.artifactId} + ${native.classifier} + pom.xml + false + + + + + maven-surefire-plugin