update #183
This file contains hidden or 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: Build NGE | |
| on: | |
| push: | |
| pull_request: | |
| release: | |
| types: [published, released] | |
| jobs: | |
| # Build natives on android | |
| BuildAndroidNatives: | |
| name: Build natives for android | |
| runs-on: ubuntu-latest | |
| container: | |
| image: ghcr.io/cirruslabs/android-sdk:35-ndk | |
| steps: | |
| - name: Clone the repo | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: '21' | |
| - name: Check java version | |
| run: java -version | |
| - name: Install CMake | |
| run: | | |
| apt-get update | |
| apt-get install -y cmake | |
| cmake --version | |
| - name: Validate the Gradle wrap-per | |
| uses: gradle/actions/wrapper-validation@v4 | |
| - name: Build | |
| run: | | |
| export VERSION="" | |
| if [[ "${GITHUB_REF}" == refs/tags/* ]]; then | |
| export VERSION=${GITHUB_REF#refs/tags/} | |
| echo "Publishing release $VERSION" | |
| fi | |
| export ANDROID_NDK="$ANDROID_SDK_ROOT/ndk/$ANDROID_NDK_VERSION" | |
| ls -la "$ANDROID_SDK_ROOT" | |
| ls -la "$ANDROID_NDK" | |
| ./gradlew --no-daemon -PbuildNativeProjects=true \ | |
| -PjmeVersionName="$VERSION" \ | |
| build :jme3-android-native:assemble | |
| find . -type f -print | |
| - name: Upload natives | |
| uses: actions/upload-artifact@master | |
| with: | |
| name: android-natives | |
| path: build/native | |
| # Build the engine, only deploy from ubuntu-latest jdk21 | |
| BuildEngine: | |
| needs: [BuildAndroidNatives] | |
| name: Build on ${{ matrix.osName }} jdk${{ matrix.jdk }} | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| id-token: write | |
| pages: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macOS-latest] | |
| include: | |
| - os: ubuntu-latest | |
| osName: linux | |
| deploy: true | |
| - os: windows-latest | |
| osName: windows | |
| deploy: false | |
| - os: macOS-latest | |
| osName: mac | |
| deploy: false | |
| steps: | |
| - name: Clone the repo | |
| uses: actions/checkout@v4 | |
| - name: Setup the java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '21' | |
| - name: Download natives for android | |
| uses: actions/download-artifact@master | |
| with: | |
| name: android-natives | |
| path: build/native | |
| - name: Validate the Gradle wrapper | |
| uses: gradle/actions/wrapper-validation@v4 | |
| - name: Build Engine | |
| shell: bash | |
| run: | | |
| export VERSION="" | |
| if [[ "${GITHUB_REF}" == refs/tags/* ]]; then | |
| export VERSION=${GITHUB_REF#refs/tags/} | |
| echo "Publishing release $VERSION" | |
| fi | |
| ./gradlew --no-daemon configureVersionInfo \ | |
| -PjmeVersionName="$VERSION" \ | |
| -PskipPrebuildLibraries=true \ | |
| build mergedJavadoc | |
| - name: "Create merged native zip" | |
| if: matrix.deploy == true | |
| shell: bash | |
| run: | | |
| cdir="$PWD" | |
| cd "build/native" | |
| zip -r "$cdir/dist/merged-natives.zip" * | |
| cd "$cdir" | |
| echo "Done" | |
| - name: Upload merged natives | |
| if: matrix.deploy==true | |
| uses: actions/upload-artifact@master | |
| with: | |
| name: merged-natives | |
| path: dist/merged-natives.zip | |
| - name: Publish Snapshot | |
| if: matrix.deploy == true && github.event_name != 'pull_request' && ( github.event_name != 'release' || github.event.release.prerelease == true ) | |
| env: | |
| SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
| SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
| GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | |
| GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| run: | | |
| export VERSION="" | |
| if [[ "${GITHUB_REF}" == refs/tags/* ]]; then | |
| export VERSION=${GITHUB_REF#refs/tags/} | |
| echo "Publishing release $VERSION" | |
| fi | |
| ./gradlew --no-daemon --no-parallel configureVersionInfo \ | |
| -PjmeVersionName="$VERSION" \ | |
| -PskipPrebuildLibraries=true \ | |
| publishToSonatype publishAllPublicationsToDistFolderRepository --info | |
| - name: Publish Release | |
| if: matrix.deploy == true && github.event_name == 'release' && github.event.release.prerelease == false | |
| env: | |
| SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
| SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
| GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | |
| GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| run: | | |
| export VERSION="" | |
| if [[ "${GITHUB_REF}" == refs/tags/* ]]; then | |
| export VERSION=${GITHUB_REF#refs/tags/} | |
| echo "Publishing release $VERSION" | |
| fi | |
| ./gradlew --no-daemon --no-parallel configureVersionInfo \ | |
| -PjmeVersionName="$VERSION" \ | |
| -PskipPrebuildLibraries=true \ | |
| publishToSonatype closeAndReleaseSonatypeStagingRepository publishAllPublicationsToDistFolderRepository --info | |
| - name: Upload maven artifacts | |
| if: matrix.deploy==true | |
| uses: actions/upload-artifact@master | |
| with: | |
| name: maven-artifacts | |
| path: dist/maven | |
| - name: Upload pages artifact | |
| if: matrix.deploy==true | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: 'dist/javadoc' | |
| - name: Deploy to GitHub Pages | |
| if: matrix.deploy==true && github.event_name == 'release' | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |