test node24 create release #50
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: Release | |
| on: | |
| workflow_dispatch: # allows manual triggering | |
| inputs: | |
| create_release: | |
| description: 'Create new release' | |
| required: true | |
| type: boolean | |
| push: | |
| branches: | |
| - master | |
| paths: [ | |
| '.github/workflows/release.yml', | |
| '**/CMakeLists.txt', | |
| '**/.cmake', | |
| '**/*.h', | |
| '**/*.hpp', | |
| '**/*.c', | |
| '**/*.cpp', | |
| '**/*.cu', | |
| '**/*.cuh', | |
| '**/*.swift', | |
| '**/*.m', | |
| '**/*.metal', | |
| '**/*.comp', | |
| '**/*.glsl' | |
| ] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }} | |
| cancel-in-progress: true | |
| env: | |
| BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
| CMAKE_ARGS: "-DLLAMA_BUILD_EXAMPLES=OFF -DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_TOOLS=ON -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON" | |
| jobs: | |
| ubuntu-cpu: | |
| strategy: | |
| matrix: | |
| include: | |
| - build: 'x64' | |
| os: ubuntu-22.04 | |
| - build: 'arm64' | |
| os: ubuntu-24.04-arm | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Clone | |
| id: checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: ccache | |
| if: ${{ matrix.build != 's390x' }} | |
| uses: ggml-org/ccache-action@v1.2.21 | |
| with: | |
| key: ubuntu-cpu-${{ matrix.build }} | |
| evict-old-files: 1d | |
| - name: Dependencies | |
| id: depends | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install build-essential libssl-dev | |
| - name: Toolchain workaround (GCC 14) | |
| if: ${{ contains(matrix.os, 'ubuntu-24.04') }} | |
| run: | | |
| sudo apt-get install -y gcc-14 g++-14 | |
| echo "CC=gcc-14" >> "$GITHUB_ENV" | |
| echo "CXX=g++-14" >> "$GITHUB_ENV" | |
| - name: Build | |
| id: cmake_build | |
| run: | | |
| cmake -B build \ | |
| -DCMAKE_INSTALL_RPATH='$ORIGIN' \ | |
| -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \ | |
| -DGGML_BACKEND_DL=ON \ | |
| -DGGML_NATIVE=OFF \ | |
| -DGGML_CPU_ALL_VARIANTS=ON \ | |
| -DLLAMA_FATAL_WARNINGS=ON \ | |
| ${{ env.CMAKE_ARGS }} | |
| cmake --build build --config Release -j $(nproc) | |
| - name: Determine tag name | |
| id: tag | |
| uses: ./.github/actions/get-tag-name | |
| - name: Pack artifacts | |
| id: pack_artifacts | |
| run: | | |
| cp LICENSE ./build/bin/ | |
| tar -czvf llama-${{ steps.tag.outputs.name }}-bin-ubuntu-${{ matrix.build }}.tar.gz --transform "s,./,llama-${{ steps.tag.outputs.name }}/," -C ./build/bin . | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| path: llama-${{ steps.tag.outputs.name }}-bin-ubuntu-${{ matrix.build }}.tar.gz | |
| name: llama-bin-ubuntu-${{ matrix.build }}.tar.gz | |
| release: | |
| if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} | |
| # Fine-grant permission | |
| # https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token | |
| permissions: | |
| contents: write # for creating release | |
| runs-on: ubuntu-slim | |
| needs: | |
| - ubuntu-cpu | |
| steps: | |
| - name: Clone | |
| id: checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Determine tag name | |
| id: tag | |
| uses: ./.github/actions/get-tag-name | |
| - name: Download artifacts | |
| id: download-artifact | |
| uses: actions/download-artifact@v7 | |
| with: | |
| path: ./artifact | |
| merge-multiple: true | |
| - name: Move artifacts | |
| id: move_artifacts | |
| run: | | |
| mkdir -p release | |
| echo "Moving other artifacts..." | |
| mv -v artifact/*.tar.gz release | |
| - name: Create release | |
| id: create_release | |
| uses: CISC/action-create-release@8638045a13da7e0d66e99c60beb73216d5ce5a90 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ steps.tag.outputs.name }} | |
| body: | | |
| <details open> | |
| ${{ github.event.head_commit.message }} | |
| </details> | |
| **Linux:** | |
| - [Ubuntu x64 (CPU)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-ubuntu-x64.tar.gz) | |
| - [Ubuntu arm64 (CPU)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-ubuntu-arm64.tar.gz) | |
| - name: Upload release | |
| id: upload_release | |
| uses: actions/github-script@v8 | |
| with: | |
| github-token: ${{secrets.GITHUB_TOKEN}} | |
| script: | | |
| const path = require('path'); | |
| const fs = require('fs'); | |
| const release_id = '${{ steps.create_release.outputs.id }}'; | |
| for (let file of await fs.readdirSync('./release')) { | |
| if (path.extname(file) === '.zip' || file.endsWith('.tar.gz')) { | |
| console.log('uploadReleaseAsset', file); | |
| await github.rest.repos.uploadReleaseAsset({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| release_id: release_id, | |
| name: file, | |
| data: await fs.readFileSync(`./release/${file}`) | |
| }); | |
| } | |
| } |