Skip to content

Commit 79867cb

Browse files
committed
Update deployment workflow
1 parent da25e8a commit 79867cb

File tree

1 file changed

+34
-14
lines changed

1 file changed

+34
-14
lines changed

.github/workflows/deploy.yaml

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,47 @@
1-
name: Deploy to Maven
2-
1+
name: Publish package to the Maven Central Repository
32
on:
43
release:
54
types:
65
- published
76
jobs:
8-
deploy:
9-
name: Push the Java SDK Maven
7+
publish:
108
if: ${{ !github.event.release.prerelease && github.event.release.target_commitish == 'main' }}
119
runs-on: ubuntu-latest
1210
steps:
13-
- name: Checkout
14-
uses: actions/checkout@v1
15-
- name: Set release version
11+
- uses: actions/checkout@v2
12+
- name: Set up JDK 11
13+
uses: actions/setup-java@v2
14+
with:
15+
distribution: 'adopt'
16+
java-version: '11'
17+
18+
- name: Set Maven project version
1619
run: |
17-
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV
18-
echo $RELEASE_VERSION
19-
- name: Java Maven Upload
20-
uses: ./.github/actions/deploy
20+
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV
21+
mvn versions:set -DnewVersion=$RELEASE_VERSION
22+
23+
- name: Build with Maven
24+
run: mvn -B package --file pom.xml
25+
26+
- uses: actions/checkout@v2
27+
- name: Set up Apache Maven Central
28+
uses: actions/setup-java@v2
29+
with:
30+
distribution: 'adopt'
31+
java-version: '11'
32+
server-id: ossrh
33+
server-username: MAVEN_USERNAME
34+
server-password: MAVEN_CENTRAL_TOKEN
35+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
36+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
37+
38+
- name: Publish to Apache Maven Central
39+
run: mvn deploy
2140
env:
22-
MVN_USERNAME: ${{ secrets.MVN_USERNAME }}
23-
MVN_PASSWORD: ${{ secrets.MVN_PASSWORD }}
24-
GPG_KEY_PASSPHRASE: ${{ secrets.PRIVATE_KEY_PASSPHRASE }}
41+
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
42+
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
43+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
44+
# Integration test environment variables.
2545
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
2646
BW_PASSWORD: ${{ secrets.BW_PASSWORD }}
2747
BW_USERNAME: ${{ secrets.BW_USERNAME }}

0 commit comments

Comments
 (0)