|
| 1 | +name: Release GraalVM Native Image (Example Desktop App) |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: write |
| 11 | + |
| 12 | +concurrency: |
| 13 | + group: release-graalvm-${{ github.ref }} |
| 14 | + cancel-in-progress: false |
| 15 | + |
| 16 | +jobs: |
| 17 | + build-natives: |
| 18 | + uses: ./.github/workflows/build-natives.yaml |
| 19 | + |
| 20 | + build: |
| 21 | + needs: build-natives |
| 22 | + name: GraalVM - ${{ matrix.name }} |
| 23 | + runs-on: ${{ matrix.os }} |
| 24 | + timeout-minutes: 60 |
| 25 | + strategy: |
| 26 | + fail-fast: false |
| 27 | + matrix: |
| 28 | + include: |
| 29 | + - name: Linux x64 |
| 30 | + os: ubuntu-latest |
| 31 | + arch: amd64 |
| 32 | + - name: Linux ARM64 |
| 33 | + os: ubuntu-24.04-arm |
| 34 | + arch: arm64 |
| 35 | + - name: macOS ARM64 |
| 36 | + os: macos-latest |
| 37 | + arch: arm64 |
| 38 | + - name: macOS Intel |
| 39 | + os: macos-15-intel |
| 40 | + arch: amd64 |
| 41 | + - name: Windows x64 |
| 42 | + os: windows-latest |
| 43 | + arch: amd64 |
| 44 | + |
| 45 | + steps: |
| 46 | + - name: Checkout repo |
| 47 | + uses: actions/checkout@v4 |
| 48 | + with: |
| 49 | + fetch-depth: 0 |
| 50 | + |
| 51 | + - name: Download PDFium JNI natives |
| 52 | + uses: actions/download-artifact@v4 |
| 53 | + with: |
| 54 | + path: pdfium/src/jvmMain/resources/pdfium/native/ |
| 55 | + pattern: 'pdfium-jni-*' |
| 56 | + merge-multiple: true |
| 57 | + |
| 58 | + - name: Select Xcode 26 (macOS) |
| 59 | + if: runner.os == 'macOS' |
| 60 | + run: sudo xcode-select -s /Applications/Xcode_26.0.app/Contents/Developer |
| 61 | + |
| 62 | + - name: Setup Liberica NIK (GraalVM) |
| 63 | + uses: graalvm/setup-graalvm@v1 |
| 64 | + with: |
| 65 | + distribution: 'liberica' |
| 66 | + java-version: '25' |
| 67 | + |
| 68 | + - name: Setup MSVC (Windows) |
| 69 | + if: runner.os == 'Windows' |
| 70 | + uses: ilammy/msvc-dev-cmd@v1 |
| 71 | + |
| 72 | + - name: Setup Android SDK (Linux ARM64) |
| 73 | + if: matrix.os == 'ubuntu-24.04-arm' |
| 74 | + uses: android-actions/setup-android@v3 |
| 75 | + |
| 76 | + - name: Setup Gradle |
| 77 | + uses: gradle/actions/setup-gradle@v5 |
| 78 | + |
| 79 | + - name: Build GraalVM native package |
| 80 | + shell: bash |
| 81 | + run: | |
| 82 | + set -euo pipefail |
| 83 | + case "$RUNNER_OS" in |
| 84 | + Linux) TASK=packageGraalvmDeb ;; |
| 85 | + macOS) TASK=packageGraalvmDmg ;; |
| 86 | + Windows) TASK=packageGraalvmNsis ;; |
| 87 | + esac |
| 88 | + ./gradlew ":example:$TASK" -PnativeMarch=compatibility --no-daemon --stacktrace |
| 89 | +
|
| 90 | + - name: Upload GraalVM artifact |
| 91 | + uses: actions/upload-artifact@v4 |
| 92 | + with: |
| 93 | + name: graalvm-${{ runner.os }}-${{ matrix.arch }} |
| 94 | + path: | |
| 95 | + example/build/compose/binaries/**/graalvm-*/** |
| 96 | + if-no-files-found: error |
| 97 | + |
| 98 | + publish: |
| 99 | + name: Publish GitHub Release |
| 100 | + needs: build |
| 101 | + if: ${{ !cancelled() && needs.build.result == 'success' }} |
| 102 | + runs-on: ubuntu-latest |
| 103 | + timeout-minutes: 15 |
| 104 | + env: |
| 105 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 106 | + steps: |
| 107 | + - name: Download all GraalVM artifacts |
| 108 | + uses: actions/download-artifact@v4 |
| 109 | + with: |
| 110 | + path: artifacts |
| 111 | + pattern: graalvm-* |
| 112 | + |
| 113 | + - name: Determine version |
| 114 | + shell: bash |
| 115 | + run: | |
| 116 | + set -euo pipefail |
| 117 | + TAG="${GITHUB_REF_NAME}" |
| 118 | + VERSION="${TAG#v}" |
| 119 | + echo "TAG=$TAG" >> "$GITHUB_ENV" |
| 120 | + echo "VERSION=$VERSION" >> "$GITHUB_ENV" |
| 121 | + if [[ "$VERSION" == *"-alpha"* ]] || [[ "$VERSION" == *"-beta"* ]]; then |
| 122 | + echo "PRERELEASE=true" >> "$GITHUB_ENV" |
| 123 | + else |
| 124 | + echo "PRERELEASE=false" >> "$GITHUB_ENV" |
| 125 | + fi |
| 126 | +
|
| 127 | + - name: Collect release assets |
| 128 | + shell: bash |
| 129 | + run: | |
| 130 | + set -euo pipefail |
| 131 | + mkdir -p release-assets |
| 132 | + find artifacts -type f \( -name '*.deb' -o -name '*.dmg' -o -name '*.exe' \) -exec cp {} release-assets/ \; |
| 133 | + ls -lh release-assets/ |
| 134 | +
|
| 135 | + - name: Upload to GitHub Release |
| 136 | + shell: bash |
| 137 | + run: | |
| 138 | + set -euo pipefail |
| 139 | + REPO="${{ github.repository }}" |
| 140 | + if [ -z "$(ls -A release-assets/)" ]; then |
| 141 | + echo "::error::No release assets found" |
| 142 | + exit 1 |
| 143 | + fi |
| 144 | + if ! gh release view "$TAG" -R "$REPO" > /dev/null 2>&1; then |
| 145 | + ARGS=(release create "$TAG" --title "$TAG" --generate-notes -R "$REPO") |
| 146 | + if [ "$PRERELEASE" = "true" ]; then |
| 147 | + ARGS+=(--prerelease) |
| 148 | + fi |
| 149 | + gh "${ARGS[@]}" |
| 150 | + fi |
| 151 | + gh release upload "$TAG" release-assets/* --clobber -R "$REPO" |
0 commit comments