Files
notevc/.github/workflows/release.yml
2025-11-10 14:42:25 -05:00

145 lines
4.2 KiB
YAML

name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 1.0.0)'
required: true
type: string
jobs:
build:
name: Build ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: linux-x64
binary-name: notevc
- os: macos-15-intel
platform: macos-x64
binary-name: notevc
- os: macos-latest
platform: macos-arm64
binary-name: notevc
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install native build tools (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential zlib1g-dev
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Debug - Check Java and GraalVM
run: |
echo "Java version:"
java -version
echo "JAVA_HOME: $JAVA_HOME"
echo "PATH: $PATH"
echo "GraalVM native-image:"
which native-image || echo "native-image not found"
native-image --version || echo "native-image version failed"
- name: Debug - Check Gradle
run: |
echo "Gradle version:"
./gradlew --version
echo "Gradle tasks:"
./gradlew tasks --group="graalvm native image"
- name: Build with verbose output
run: |
echo "Starting build..."
./gradlew clean nativeCompile --info --stacktrace
continue-on-error: true
- name: Debug - Check build output
if: always()
run: |
echo "Build directory contents:"
find build -type f -name "*" 2>/dev/null || echo "Build directory not found"
echo "Native compile directory:"
ls -la build/native/ 2>/dev/null || echo "Native directory not found"
ls -la build/native/nativeCompile/ 2>/dev/null || echo "NativeCompile directory not found"
- name: Try alternative build approach
if: failure()
run: |
echo "Trying shadowJar first..."
./gradlew shadowJar --info
echo "ShadowJar contents:"
ls -la build/libs/ || echo "No libs directory"
echo "Trying nativeCompile again..."
./gradlew nativeCompile --info --stacktrace
- name: Package binary (if exists)
if: success()
run: |
mkdir -p dist
if [ -f "build/native/nativeCompile/${{ matrix.binary-name }}" ]; then
cp build/native/nativeCompile/${{ matrix.binary-name }} dist/
cd dist
tar -czf notevc-${{ matrix.platform }}.tar.gz ${{ matrix.binary-name }}
# Generate SHA256
if [[ "${{ runner.os }}" == "Linux" ]]; then
sha256sum notevc-${{ matrix.platform }}.tar.gz > notevc-${{ matrix.platform }}.tar.gz.sha256
else
shasum -a 256 notevc-${{ matrix.platform }}.tar.gz > notevc-${{ matrix.platform }}.tar.gz.sha256
fi
echo "Successfully packaged binary"
else
echo "Binary not found at build/native/nativeCompile/${{ matrix.binary-name }}"
exit 1
fi
- name: Upload build artifacts
if: success()
uses: actions/upload-artifact@v4
with:
name: notevc-${{ matrix.platform }}
path: |
dist/notevc-${{ matrix.platform }}.tar.gz
dist/notevc-${{ matrix.platform }}.tar.gz.sha256
- name: Upload logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: build-logs-${{ matrix.platform }}
path: |
build/reports/
~/.gradle/daemon/
if-no-files-found: ignore