-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (52 loc) · 2 KB
/
Copy pathpublish-java.yml
File metadata and controls
59 lines (52 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Publish Java SDK
on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: 'Version to publish (e.g., 1.0.0)'
required: true
type: string
jobs:
publish:
name: Publish to Maven Central
# Only publish on a java-sdk-v* release (or a manual dispatch). Without this
# guard the job runs on EVERY release event, so cutting js/py/go/php/ruby
# releases together fires concurrent Maven deployments of the same
# com.turbodocx:turbodocx-sdk coordinate, which collide ("currently being
# published in another deployment"). The other publish workflows already
# filter this way.
if: github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, 'java-sdk-v')
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/java-sdk
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
cache: 'maven'
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Update version (workflow_dispatch)
if: github.event_name == 'workflow_dispatch'
run: |
mvn versions:set -DnewVersion=${{ inputs.version }}
mvn versions:commit
- name: Build and Test
run: mvn clean verify -B -Dgpg.passphrase=${{ secrets.MAVEN_GPG_PASSPHRASE }}
env:
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: Publish to Maven Central
run: mvn deploy -B -DskipTests -Dgpg.passphrase=${{ secrets.MAVEN_GPG_PASSPHRASE }}
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}