Skip to content

feat: Build and Publish refactor #11

feat: Build and Publish refactor

feat: Build and Publish refactor #11

Workflow file for this run

name: 'Build Binary'
description: |
This workflow builds the binary files for Linux. The build binaries are stored as artifact
and may be reused by other workflows.
on:
push:
branches: [ main ]
pull_request: {}
jobs:
build-binary:
name: 'Build Binary'
runs-on: ubuntu-latest
container:
image: ubuntu:24.04
steps:
- name: 'Checkout repository'
uses: actions/checkout@v4
- name: 'Install dependencies'
env:
DEBIAN_FRONTEND: noninteractive
run: |
apt-get update
apt-get install -y --no-install-recommends ninja-build g++ git ca-certificates
rm -rf /var/lib/apt/lists/*
- name: 'Setup CMake >= 3.30'
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.31.x'
- name: 'Configure CMake'
env:
CXX: g++
run: |
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
- name: 'Build'
id: 'build'
run: |
cmake --build build --config Release
VERSION=$(cat build/version.txt)
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: 'Upload artifacts'
uses: actions/upload-artifact@v4
with:
name: libcpp_bindings_linux_x86_64
path: build/libcpp_bindings_linux.so*
outputs:
version: ${{ steps.build.outputs.VERSION }}
trigger-publish:
needs: ['build-binary']
uses: ./.github/workflows/publish_jsr.yml
with:
publish: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
version: ${{ needs.build-binary.outputs.version }}
artifact-name: libcpp_bindings_linux_x86_64
permissions:
contents: read
id-token: write