Update release.yaml

This commit is contained in:
2025-12-17 14:25:50 +01:00
committed by GitHub
parent c734329a62
commit 4269d04381

View File

@@ -45,15 +45,23 @@ jobs:
build:
name: Build Binaries
needs: build-webui
runs-on: ubuntu-latest
runs-on: ${{ matrix.runner }}
strategy:
matrix:
goos: [linux, windows, darwin]
goarch: [amd64, arm64]
exclude:
# Windows ARM64 support is limited
- goos: windows
include:
- goos: linux
goarch: amd64
runner: ubuntu-latest
- goos: linux
goarch: arm64
runner: ubuntu-latest
cc: aarch64-linux-gnu-gcc
- goos: darwin
goarch: arm64
runner: macos-latest
- goos: windows
goarch: amd64
runner: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
@@ -70,20 +78,23 @@ jobs:
name: webui-dist
path: webui/dist/
- name: Build binary
- name: Install cross-compilation tools (Linux ARM64 only)
if: matrix.cc != ''
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Build binary (Unix)
if: matrix.goos != 'windows'
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
CGO_ENABLED: 1
CC: ${{ matrix.cc }}
shell: bash
run: |
# Set binary extension for Windows
BINARY_NAME="llamactl"
if [ "${{ matrix.goos }}" = "windows" ]; then
BINARY_NAME="${BINARY_NAME}.exe"
fi
# Build the binary
go build -ldflags="-s -w -X main.version=${{ github.ref_name }} -X main.commit=${{ github.sha }} -X main.date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" -o "${BINARY_NAME}" ./cmd/server
go build -ldflags="-s -w -X main.version=${{ github.ref_name }} -X main.commit=${{ github.sha }} -X main.date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" -o llamactl ./cmd/server
# Create archive
ARCHIVE_OS="${{ matrix.goos }}"
@@ -91,16 +102,33 @@ jobs:
ARCHIVE_OS="macos"
fi
ARCHIVE_NAME="llamactl-${{ github.ref_name }}-${ARCHIVE_OS}-${{ matrix.goarch }}"
if [ "${{ matrix.goos }}" = "windows" ]; then
zip "${ARCHIVE_NAME}.zip" "${BINARY_NAME}"
echo "ASSET_PATH=${ARCHIVE_NAME}.zip" >> $GITHUB_ENV
else
tar -czf "${ARCHIVE_NAME}.tar.gz" "${BINARY_NAME}"
echo "ASSET_PATH=${ARCHIVE_NAME}.tar.gz" >> $GITHUB_ENV
fi
tar -czf "${ARCHIVE_NAME}.tar.gz" llamactl
echo "ASSET_PATH=${ARCHIVE_NAME}.tar.gz" >> $GITHUB_ENV
echo "ASSET_NAME=${ARCHIVE_NAME}" >> $GITHUB_ENV
- name: Build binary (Windows)
if: matrix.goos == 'windows'
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 1
shell: pwsh
run: |
# Build the binary
$version = "${{ github.ref_name }}"
$commit = "${{ github.sha }}"
$date = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")
$ldflags = "-s -w -X main.version=$version -X main.commit=$commit -X main.date=$date"
go build -ldflags="$ldflags" -o llamactl.exe ./cmd/server
# Create archive
$archiveName = "llamactl-${{ github.ref_name }}-windows-${{ matrix.goarch }}"
Compress-Archive -Path llamactl.exe -DestinationPath "$archiveName.zip"
echo "ASSET_PATH=$archiveName.zip" >> $env:GITHUB_ENV
echo "ASSET_NAME=$archiveName" >> $env:GITHUB_ENV
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
@@ -179,4 +207,4 @@ jobs:
with:
files: assets/checksums.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}