Publish package to the Maven Central Repository #73
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish package to the Maven Central Repository | |
on: | |
workflow_dispatch: {} | |
push: | |
tags: | |
- reddio-java/** | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Maven Central Repository | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '8' | |
distribution: 'adopt' | |
server-id: ossrh | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_PASSWORD | |
- name: Download Latest Native Library | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
github_token: ${{secrets.GITHUB_TOKEN}} | |
workflow: unity-plugin-zip.yaml | |
workflow_conclusion: success | |
path: artifacts | |
- name: Copy Native Library to Java Project | |
run: | | |
mkdir -p output/lib | |
mkdir -p output/lib/darwin-aarch64 | |
mkdir -p output/lib/darwin-x86-64 | |
cp artifacts/libreddio-x86_64-pc-windows-msvc/reddio.dll output/lib/reddio.dll | |
cp artifacts/libreddio-x86_64-unknown-linux-gnu/libreddio.so output/lib/libreddio.so | |
cp artifacts/libreddio-aarch64-apple-darwin/libreddio.dylib output/lib/darwin-aarch64/libreddio.dylib | |
cp artifacts/libreddio-x86_64-apple-darwin/libreddio.dylib output/lib/darwin-x86-64/libreddio.dylib | |
ls -alhR output/lib | |
- name: Import GPG key | |
id: import_gpg | |
uses: crazy-max/ghaction-import-gpg@v5 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.GPG_PASSPHRASE }} | |
- name: Cache Maven | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.m2 | |
~/repository | |
key: ${{ github.job }}-${{ hashFiles('**/pom.xml') }} | |
- name: Publish package | |
working-directory: reddio-java | |
run: | | |
mvn -B clean verify gpg:sign deploy -DskipTests -Dgpg.keyname=$GPG_KEYNAME -Dgpg.passphrase=$GPG_PASSPHRASE -Dgpg.skip=false | |
env: | |
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} | |
GPG_KEYNAME: ${{ secrets.GPG_KEYNAME }} | |
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
- name: Upload Jars as Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: reddio-java-sdk | |
path: | | |
reddio-java/**/*.jar |