Publish Java #31
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 Java | |
on: | |
workflow_dispatch: | |
jobs: | |
release-linux: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
# - binary: libyggdrasilffi_x86_64.so | |
# platform: x86_64-linux | |
- binary: libyggdrasilffi_arm64.so | |
platform: arm-linux | |
# - binary: libyggdrasilffi_x86_64-musl.so | |
# platform: x86_64-linux-musl | |
# - binary: libyggdrasilffi_arm64-musl.so | |
# platform: aarch64-linux-musl | |
# - binary: yggdrasilffi_x86_64.dll | |
# platform: x64-mingw32 | |
# - binary: yggdrasilffi_arm64.dll | |
# platform: arm64-mingw32 | |
# - binary: libyggdrasilffi_x86_64.dylib | |
# platform: x86_64-darwin | |
# - binary: libyggdrasilffi_arm64.dylib | |
# platform: arm64-darwin | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Extract Yggdrasil Core Version | |
run: | | |
cd java-engine | |
CORE_VERSION=$(grep -E '^yggdrasilCoreVersion=' gradle.properties | cut -d'=' -f2) | |
echo "FFI Library Version: $CORE_VERSION" | |
echo "CORE_VERSION=$CORE_VERSION" >> $GITHUB_ENV | |
- name: Set Platform Property for Gradle | |
run: | | |
echo "platform=${{ matrix.platform }}" >> $GITHUB_ENV | |
- name: Download Binary | |
run: | | |
BINARY_URL="https://github.com/${{ github.repository }}/releases/download/unleash-yggdrasil-v${CORE_VERSION}/${{ matrix.binary }}" | |
TARGET_DIR="java-engine/src/main/resources/native" | |
mkdir -p "$TARGET_DIR" | |
curl -L -o "$TARGET_DIR/${{ matrix.binary }}" \ | |
-H "Authorization: token $GITHUB_TOKEN" \ | |
"$BINARY_URL" | |
if [ -f "$TARGET_DIR/${{ matrix.binary }}" ]; then | |
echo "${{ matrix.binary }} downloaded successfully to $TARGET_DIR." | |
else | |
echo "Error: ${{ matrix.binary }} could not be downloaded." | |
exit 1 | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish to Sonatype | |
env: | |
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }} | |
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} | |
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }} | |
ORG_GRADLE_PROJECT_signingPassphrase: ${{ secrets.GPG_PASSPHRASE }} | |
run: | | |
cd java-engine | |
./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository -Pplatform=${{ matrix.platform }} |