Skip to content

Commit af0de90

Browse files
committed
chore(cicd): deploy releases from GHA
1 parent 070f5c8 commit af0de90

1 file changed

Lines changed: 46 additions & 41 deletions

File tree

.github/workflows/build.yml

Lines changed: 46 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ on:
1111
- r[0-9]+.*
1212
types: [opened, reopened, synchronize, labeled, unlabeled]
1313
env:
14-
STAGING_PROFILE_ID: 46f80d0729c92d
15-
DEPLOY_SNAPSHOT: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/staging') }}
16-
DEPLOY_RELEASE: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/r') }}
14+
# STAGING_PROFILE_ID: 46f80d0729c92d
15+
# DEPLOY_SNAPSHOT: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/staging') }}
16+
# DEPLOY_RELEASE: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/r') }}
17+
DEPLOY: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/r')) }}
1718
jobs:
1819
check-format:
1920
if: github.event_name == 'pull_request'
@@ -36,37 +37,37 @@ jobs:
3637
- name: Run format checks
3738
run: |
3839
mvn spotless:check -Pjdk17 -B -U -e
39-
prepare:
40-
runs-on: ubuntu-22.04
41-
outputs:
42-
repositoryUrl: ${{ steps.repository.outputs.repositoryUrl }}
43-
steps:
44-
- name: Create staging repository
45-
if: env.DEPLOY_RELEASE == 'true'
46-
id: staging
47-
run: |
48-
echo "Creating staging repository with profile $STAGING_PROFILE_ID"
49-
echo "<promoteRequest><data><description>Releasing TF Java - created by CI build</description></data></promoteRequest>" > request.xml
50-
curl -X POST -d @request.xml -s -o response.xml -u ${{ secrets.CI_DEPLOY_USERNAME }}:${{ secrets.CI_DEPLOY_PASSWORD }} -H "Content-Type:application/xml" \
51-
https://ossrh-staging-api.central.sonatype.com/service/local/staging/profiles/$STAGING_PROFILE_ID/start
52-
export STAGING_REPOSITORY_ID=`awk -F'[<>]' '/stagedRepositoryId/{print $3}' response.xml`
53-
echo "Staging repository created: $STAGING_REPOSITORY_ID"
54-
echo "::set-output name=stagingRepositoryId::$STAGING_REPOSITORY_ID"
55-
- name: Checkout repository
56-
uses: actions/checkout@v6
57-
- name: Extract distribution repository URL
58-
id: repository
59-
run: |
60-
if [[ "${{ env.DEPLOY_RELEASE }}" = "true" ]]; then
61-
export REPOSITORY_URL=`mvn exec:exec -q -N -Dexec.executable='echo' -Dexec.args="\\${project.distributionManagement.repository.url}" -DstagingRepositoryId=${{ steps.staging.outputs.stagingRepositoryId }}`
62-
else
63-
export REPOSITORY_URL=`mvn exec:exec -q -N -Dexec.executable='echo' -Dexec.args="\\${project.distributionManagement.snapshotRepository.url}"`
64-
fi
65-
echo "Repository URL: $REPOSITORY_URL"
66-
echo "::set-output name=repositoryUrl::$REPOSITORY_URL"
40+
# prepare:
41+
# runs-on: ubuntu-22.04
42+
# outputs:
43+
# repositoryUrl: ${{ steps.repository.outputs.repositoryUrl }}
44+
# steps:
45+
# - name: Create staging repository
46+
# if: env.DEPLOY_RELEASE == 'true'
47+
# id: staging
48+
# run: |
49+
# echo "Creating staging repository with profile $STAGING_PROFILE_ID"
50+
# echo "<promoteRequest><data><description>Releasing TF Java - created by CI build</description></data></promoteRequest>" > request.xml
51+
# curl -X POST -d @request.xml -s -o response.xml -u ${{ secrets.CI_DEPLOY_USERNAME }}:${{ secrets.CI_DEPLOY_PASSWORD }} -H "Content-Type:application/xml" \
52+
# https://ossrh-staging-api.central.sonatype.com/service/local/staging/profiles/$STAGING_PROFILE_ID/start
53+
# export STAGING_REPOSITORY_ID=`awk -F'[<>]' '/stagedRepositoryId/{print $3}' response.xml`
54+
# echo "Staging repository created: $STAGING_REPOSITORY_ID"
55+
# echo "::set-output name=stagingRepositoryId::$STAGING_REPOSITORY_ID"
56+
# - name: Checkout repository
57+
# uses: actions/checkout@v6
58+
# - name: Extract distribution repository URL
59+
# id: repository
60+
# run: |
61+
# if [[ "${{ env.DEPLOY_RELEASE }}" = "true" ]]; then
62+
# export REPOSITORY_URL=`mvn exec:exec -q -N -Dexec.executable='echo' -Dexec.args="\\${project.distributionManagement.repository.url}" -DstagingRepositoryId=${{ steps.staging.outputs.stagingRepositoryId }}`
63+
# else
64+
# export REPOSITORY_URL=`mvn exec:exec -q -N -Dexec.executable='echo' -Dexec.args="\\${project.distributionManagement.snapshotRepository.url}"`
65+
# fi
66+
# echo "Repository URL: $REPOSITORY_URL"
67+
# echo "::set-output name=repositoryUrl::$REPOSITORY_URL"
6768
linux-arm64:
6869
runs-on: ubuntu-2204-arm64-2c
69-
needs: prepare
70+
# needs: prepare
7071
strategy:
7172
matrix:
7273
ext: [""]
@@ -90,10 +91,11 @@ jobs:
9091
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
9192
mvn clean install -pl '!tensorflow-framework' -B -U -e -Djavacpp.platform=${{ github.job }} -Djavacpp.platform.extension=${{ matrix.ext }}
9293
- name: Build native artifact
93-
if: env.DEPLOY_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true'
94+
# if: env.DEPLOY_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true'
9495
run: mvn -f tensorflow-core/tensorflow-core-native/pom.xml package -B -e -Djavacpp.platform=${{ github.job }} -Djavacpp.platform.extension=${{ matrix.ext }}
9596
- name: Upload native artifact
96-
if: env.DEPLOY_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true'
97+
# if: env.DEPLOY_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true'
98+
if: env.DEPLOY == 'true'
9799
uses: actions/upload-artifact@v4
98100
with:
99101
name: native-artifact-${{ github.job }}${{ matrix.ext }}
@@ -102,7 +104,7 @@ jobs:
102104
retention-days: 1
103105
linux-x86_64:
104106
runs-on: ubuntu-22.04
105-
needs: prepare
107+
# needs: prepare
106108
strategy:
107109
matrix:
108110
ext: ["", -gpu]
@@ -121,10 +123,11 @@ jobs:
121123
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
122124
mvn clean install -pl '!tensorflow-framework' -B -U -e -Djavacpp.platform=${{ github.job }} -Djavacpp.platform.extension=${{ matrix.ext }}
123125
- name: Build native artifact
124-
if: env.DEPLOY_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true'
126+
# if: env.DEPLOY_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true'
125127
run: mvn -f tensorflow-core/tensorflow-core-native/pom.xml package -B -e -Djavacpp.platform=${{ github.job }} -Djavacpp.platform.extension=${{ matrix.ext }}
126128
- name: Upload native artifact
127-
if: env.DEPLOY_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true'
129+
# if: env.DEPLOY_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true'
130+
if: env.DEPLOY == 'true'
128131
uses: actions/upload-artifact@v4
129132
with:
130133
name: native-artifact-${{ github.job }}${{ matrix.ext }}
@@ -133,7 +136,7 @@ jobs:
133136
retention-days: 1
134137
macosx-arm64:
135138
runs-on: macos-14
136-
needs: prepare
139+
# needs: prepare
137140
strategy:
138141
matrix:
139142
ext: [""]
@@ -153,10 +156,11 @@ jobs:
153156
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
154157
mvn clean install -pl '!tensorflow-framework' -B -U -e -Djavacpp.platform=${{ github.job }} -Djavacpp.platform.extension=${{ matrix.ext }}
155158
- name: Build native artifact
156-
if: env.DEPLOY_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true'
159+
# if: env.DEPLOY_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true'
157160
run: mvn -f tensorflow-core/tensorflow-core-native/pom.xml package -B -e -Djavacpp.platform=${{ github.job }} -Djavacpp.platform.extension=${{ matrix.ext }}
158161
- name: Upload native artifact
159-
if: env.DEPLOY_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true'
162+
# if: env.DEPLOY_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true'
163+
if: env.DEPLOY == 'true'
160164
uses: actions/upload-artifact@v4
161165
with:
162166
name: native-artifact-${{ github.job }}${{ matrix.ext }}
@@ -165,7 +169,8 @@ jobs:
165169
retention-days: 1
166170

167171
deploy:
168-
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)
172+
# 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)
173+
if: env.DEPLOY == 'true'
169174
needs: [linux-x86_64, macosx-arm64, linux-arm64]
170175
runs-on: ubuntu-22.04
171176
steps:

0 commit comments

Comments
 (0)