Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Petoss 533 publish java sdk after manual release from GitHub #387

Merged
5 changes: 4 additions & 1 deletion .github/workflows/build-lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
distribution: 'temurin'
java-version: '11'
cache: maven
gpg-passphrase: GPG_PASSPHRASE

- name: Import GPG Key
run: |
Expand All @@ -30,5 +31,7 @@ jobs:
- name: Build and test post generation
run: |
export GPG_TTY=$(tty)
mvn clean verify -DskipTests=true -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }}
mvn clean verify -DskipTests=true
env:
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
working-directory: Xero-Java
42 changes: 42 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Publish
on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout Xero-Java repo
uses: actions/checkout@v4
with:
repository: XeroAPI/Xero-Java
path: Xero-Java

- name: Set up JDK environment
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
cache: maven
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-passphrase: GPG_PASSPHRASE

- name: Import GPG Key
run: |
echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY}}

- name: Publish to Maven
run: |
export GPG_TTY=$(tty)
mvn clean deploy -DskipTests=true
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
working-directory: Xero-Java