Skip to content

release

release #427

Workflow file for this run

name: release
on:
workflow_dispatch:
schedule:
- cron: '0 20 * * *'
env:
APP_NAME: llama
REPO_NAME: ggml-org/llama.cpp
CMAKE_ARGS: "-DLLAMA_BUILD_EXAMPLES=OFF -DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_TOOLS=ON -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON"
jobs:
check:
runs-on: ubuntu-slim
outputs:
APP_BUILD: ${{ steps.check-release.outputs.build }}
APP_VERSION: ${{ steps.get-version.outputs.APP_VERSION }}
steps:
- uses: actions/checkout@v6
- name: Get Version
id: get-version
run: |
APP_VERSION=$(curl -s "https://api.github.com/repos/${{ env.REPO_NAME }}/releases/latest" | jq -r .tag_name)
if [ -z "${APP_VERSION}" ] || [ "${APP_VERSION}" == "null" ]; then
echo "Failed to get version"
exit 1
fi
echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_ENV
echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_OUTPUT
echo ""
echo "========== Build Args =========="
echo "APP_VERSION=${APP_VERSION}"
- name: Check Release
id: check-release
run: |
gh release view ${APP_VERSION} -R ${{ github.repository }} | grep ${{ env.APP_NAME }}-.* >/dev/null 2>&1 || echo "build=1" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
runs-on: ubuntu-latest
needs: check
if: needs.check.outputs.APP_BUILD == '1'
env:
APP_VERSION: ${{ needs.check.outputs.APP_VERSION }}
steps:
- uses: actions/checkout@v6
- name: Setup QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- uses: docker/build-push-action@v7
with:
context: .
platforms: linux/loong64
load: true
push: false
build-args: |
VERSION=${{ env.APP_VERSION }}
tags: |
ghcr.io/${{ github.repository_owner }}/${{ env.APP_NAME }}:${{ env.APP_VERSION }}
outputs: type=local,dest=./
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
path: dist/
name: llama-bin-debian-loong64
release:
runs-on: ubuntu-slim
needs: [check, build]
if: needs.check.outputs.APP_BUILD == '1'
env:
APP_VERSION: ${{ needs.check.outputs.APP_VERSION }}
steps:
- uses: actions/checkout@v6
- name: Download artifacts
uses: actions/download-artifact@v8
with:
path: dist
pattern: llama-bin-*
merge-multiple: true
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG_NAME="${{ env.APP_VERSION }}"
gh release create "${TAG_NAME}" \
--generate-notes \
--title "${TAG_NAME}" \
dist/*