diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5b8cc3316f6..2f1b67bd007 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 + DEPLOY_SNAPSHOT: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/staging') }} + DEPLOY_RELEASE: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/r') }} jobs: check-format: if: github.event_name == 'pull_request' @@ -35,19 +37,30 @@ 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: ${{ env.DEPLOY_RELEASE == 'true' }} id: staging run: | echo "Creating staging repository with profile $STAGING_PROFILE_ID" echo "Releasing TF Java - created by CI build" > request.xml curl -X POST -d @request.xml -s -o response.xml -u ${{ secrets.CI_DEPLOY_USERNAME }}:${{ secrets.CI_DEPLOY_PASSWORD }} -H "Content-Type:application/xml" \ https://oss.sonatype.org/service/local/staging/profiles/$STAGING_PROFILE_ID/start - STAGING_REPOSITORY_ID=`awk -F'[<>]' '/stagedRepositoryId/{print $3}' response.xml` + export 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: Checkout repository + uses: actions/checkout@v1 + - name: Extract distribution repository URL + id: repository + run: | + if [[ "${{ env.DEPLOY_RELEASE == 'true' }}" ]]; then + export REPOSITORY_URL=`mvn exec:exec -q -N -Dexec.executable='echo' -Dexec.args="\${project.distributionManagement.repository.url}" -DstagingRepositoryId=$STAGING_REPOSITORY_ID` + else + export REPOSITORY_URL=`mvn exec:exec -q -N -Dexec.executable='echo' -Dexec.args="\${project.distributionManagement.snapshotRepository.url}"` + fi + echo "Repository URL: $REPOSITORY_URL" + echo "::set-output name=repositoryUrl::$REPOSITORY_URL" linux-x86_64: runs-on: ubuntu-20.04 needs: prepare @@ -67,7 +80,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: ${{ env.DEPLOY_RELEASE == 'true' }} || ${{ env.DEPLOY_SNAPSHOT == 'true' }} + 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 +104,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: ${{ env.DEPLOY_RELEASE == 'true' }} || ${{ env.DEPLOY_SNAPSHOT == 'true' }} + 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 +127,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: ${{ env.DEPLOY_RELEASE == 'true' }} || ${{ env.DEPLOY_SNAPSHOT == 'true' }} + 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 +170,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: ${{ env.DEPLOY_RELEASE == 'true' }} || ${{ env.DEPLOY_SNAPSHOT == 'true' }} + 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 # ${{ env.DEPLOY_SNAPSHOT == 'true' }} 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