Publish Java #37
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: Set up Binary List | |
run: | | |
# List of binaries we want to download | |
binaries=( | |
"libyggdrasilffi_x86_64.so" | |
"libyggdrasilffi_arm64.so" | |
"libyggdrasilffi_x86_64-musl.so" | |
"libyggdrasilffi_arm64-musl.so" | |
"yggdrasilffi_x86_64.dll" | |
"yggdrasilffi_arm64.dll" | |
"libyggdrasilffi_x86_64.dylib" | |
"libyggdrasilffi_arm64.dylib" | |
) | |
echo "binaries=${binaries[@]}" >> $GITHUB_ENV | |
- name: Download All Binaries | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
TARGET_DIR="java-engine/binaries" | |
mkdir -p "$TARGET_DIR" | |
for binary in ${binaries[@]}; do | |
echo "Downloading $binary..." | |
curl -L -o "$TARGET_DIR/$binary" \ | |
-H "Authorization: token $GITHUB_TOKEN" \ | |
"https://github.com/${{ github.repository }}/releases/download/unleash-yggdrasil-v${CORE_VERSION}/$binary" | |
if [ -f "$TARGET_DIR/$binary" ]; then | |
echo "$binary downloaded successfully." | |
else | |
echo "Error: $binary could not be downloaded." | |
exit 1 | |
fi | |
done | |
- 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 |