libxdk: fix include dir in CMakeList too #12
Workflow file for this run
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: Build and release libxdk | |
on: | |
push: | |
tags: | |
- 'libxdk/v*.*.*' # Trigger on tags like libxdk/v1.0.0, libxdk/v1.2.3, libxdk/v1.0.0-beta, etc but not for xdk_dev/v1.0.0 | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version number (e.g. "v1.0.0")' | |
type: string | |
required: true | |
permissions: {} | |
env: | |
LIB_VER: ${{ inputs.version }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: {} | |
defaults: | |
run: | |
working-directory: ./libxdk | |
outputs: | |
LIB_VER: ${{ steps.vars.outputs.LIB_VER }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Fix input variables | |
id: vars | |
env: | |
TAG_NAME: ${{ github.ref_name }} | |
run: | | |
if [[ -z "$LIB_VER" ]]; then | |
LIB_VER=$(echo "$TAG_NAME" | sed 's|^.*/||') | |
echo "LIB_VER=$LIB_VER" >> $GITHUB_ENV | |
fi | |
echo "LIB_VER=$LIB_VER" >> "$GITHUB_OUTPUT" | |
# Mount PWD as /workspace (writable) and build in the /workspace/build directory. | |
- name: Set up C++ build environment (to use older GCC/G++ 9.4.0 via Docker) | |
run: | | |
docker run --detach --name build_env -v $(pwd):/workspace -w /workspace ubuntu:20.04 /bin/bash -c "sleep infinity" | |
docker exec build_env bash -c "apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -yq --no-install-recommends build-essential cmake libkeyutils-dev" | |
echo "DOCKER_CMD=docker exec --user "$(id -u):$(id -g)" build_env bash -c" >> $GITHUB_ENV | |
- name: Configure CMake | |
run: ${{ env.DOCKER_CMD }} "cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=OFF" | |
- name: Build Static Library (.a) | |
run: ${{ env.DOCKER_CMD }} "cmake --build build -j$(nproc)" | |
- name: Package artifacts | |
run: | | |
PACKAGE_DIR="libxdk-$LIB_VER" | |
mkdir -p "$PACKAGE_DIR/lib" | |
mkdir -p "$PACKAGE_DIR/include/xdk" | |
cp build/libkernelXDK.a "$PACKAGE_DIR/lib/libxdk.a" | |
cp -R include "$PACKAGE_DIR/include" | |
tar -czvf "libxdk-$LIB_VER.tar.gz" "$PACKAGE_DIR/" | |
- name: Upload release package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "libxdk-${{ env.LIB_VER }}.tar.gz" | |
path: ./libxdk/libxdk-${{ env.LIB_VER }}.tar.gz | |
release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
needs: build | |
env: | |
LIB_VER: ${{ needs.build.outputs.LIB_VER }} | |
steps: | |
- name: Download release package | |
uses: actions/download-artifact@v4 | |
with: | |
name: "libxdk-${{ env.LIB_VER }}.tar.gz" | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: "libxdk-${{ env.LIB_VER }}.tar.gz" | |
name: "libxdk ${{ env.LIB_VER }}" # e.g. "Release v1.0.0" | |
tag_name: "libxdk/${{ env.LIB_VER }}" # Associate with the pushed tag | |
body: | | |
Automated build for libxdk version ${{ env.LIB_VER }} | |
This release provides the `libxdk.a` static library and public headers for Linux, built with GCC 9.4.0 on Ubuntu 20.04. | |
**Contents:** | |
- `lib/libxdk.a`: The static library. | |
- `include/xdk/`: All public header files. | |
See the commit history for detailed changes. |