Skip to content

fix: update version to 0.2.3 in CMakeLists.txt and package.json #15

fix: update version to 0.2.3 in CMakeLists.txt and package.json

fix: update version to 0.2.3 in CMakeLists.txt and package.json #15

Workflow file for this run

name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
permissions:
contents: write
jobs:
build-and-release:
name: Create GitHub Release
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # full history for changelog generation
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
- name: Verify CMakeLists.txt version matches tag
run: |
CMAKE_VERSION=$(grep -oP 'VERSION \K\d+\.\d+\.\d+' CMakeLists.txt | head -1)
TAG_VERSION=${{ steps.version.outputs.VERSION }}
TAG_VERSION_STRIPPED="${TAG_VERSION#v}"
if [[ "$CMAKE_VERSION" != "$TAG_VERSION_STRIPPED" ]]; then
echo "::error::CMakeLists.txt version ($CMAKE_VERSION) does not match tag ($TAG_VERSION_STRIPPED)"
exit 1
fi
- name: Build release (smoke-test)
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTING=ON
cmake --build build --parallel $(nproc)
- name: Run tests
working-directory: build
run: ctest --output-on-failure --parallel $(nproc)
- name: Create single-header archive
run: |
mkdir -p dist
cp -r include dist/
cp LICENSE README.md dist/
tar -czf sero-${{ steps.version.outputs.VERSION }}.tar.gz -C dist .
zip -r sero-${{ steps.version.outputs.VERSION }}.zip dist/
- name: Generate changelog since last tag
id: changelog
run: |
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
if [[ -n "$PREV_TAG" ]]; then
RANGE="${PREV_TAG}..HEAD"
else
RANGE="HEAD"
fi
NOTES=$(git log "$RANGE" --pretty=format:"- %s (%h)" --no-merges)
# Store multi-line output safely
{
echo 'NOTES<<EOF'
echo "$NOTES"
echo 'EOF'
} >> "$GITHUB_OUTPUT"
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.VERSION }}
name: "Sero ${{ steps.version.outputs.VERSION }}"
body: |
## What's Changed
${{ steps.changelog.outputs.NOTES }}
---
**Full Diff**: https://github.com/${{ github.repository }}/compare/${{ steps.version.outputs.VERSION }}
### Installation
Download the archive below and add the `include/` directory to your project, or use CMake FetchContent:
```cmake
FetchContent_Declare(sero
GIT_REPOSITORY https://github.com/${{ github.repository }}.git
GIT_TAG ${{ steps.version.outputs.VERSION }}
)
FetchContent_MakeAvailable(sero)
```
files: |
sero-${{ steps.version.outputs.VERSION }}.tar.gz
sero-${{ steps.version.outputs.VERSION }}.zip
draft: false
prerelease: ${{ contains(steps.version.outputs.VERSION, '-') }}
build-native-module:
name: Build Native Module (${{ matrix.artifact-suffix }})
runs-on: ubuntu-24.04
needs:
- build-and-release
strategy:
matrix:
include:
- artifact-suffix: linux-x64
arch: x64
- artifact-suffix: linux-arm64
arch: arm64
env:
WORKING_DIRECTORY: 'node-module'
APP_NAME: 'sero-node'
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- name: Install cross-compilation toolchain
if: matrix.arch == 'arm64'
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- name: Copy sero headers into package
run: cp -r include ${{ env.WORKING_DIRECTORY }}/include
- name: Install dependencies
working-directory: ${{ env.WORKING_DIRECTORY }}
run: bun install
- name: Build native module
if: matrix.arch != 'arm64'
working-directory: ${{ env.WORKING_DIRECTORY }}
run: bunx node-gyp rebuild
- name: Cross-compile native module (arm64)
if: matrix.arch == 'arm64'
working-directory: ${{ env.WORKING_DIRECTORY }}
env:
CC: aarch64-linux-gnu-gcc
CXX: aarch64-linux-gnu-g++
run: bunx node-gyp rebuild --arch=arm64
- name: Verify binary architecture
working-directory: ${{ env.WORKING_DIRECTORY }}
run: file ./build/Release/${{ env.APP_NAME }}.node
- name: Rename artifact
working-directory: ${{ env.WORKING_DIRECTORY }}
run: mv ./build/Release/${{ env.APP_NAME }}.node ./${{ env.APP_NAME }}-${{ matrix.artifact-suffix }}.node
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.APP_NAME }}-${{ matrix.artifact-suffix }}
path: ${{ env.WORKING_DIRECTORY }}/${{ env.APP_NAME }}-${{ matrix.artifact-suffix }}.node
if-no-files-found: error
publish-native-module:
name: Publish Native Module
runs-on: ubuntu-24.04
needs:
- build-native-module
env:
REGISTRY_URL: ${{ secrets.REGISTRY_URL }}
WORKING_DIRECTORY: 'node-module'
APP_NAME: 'sero-node'
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
registries: |
https://registry.npmjs.org/
@asl-gokart:${{ env.REGISTRY_URL }}
- name: Copy sero headers into package
run: cp -r include ${{ env.WORKING_DIRECTORY }}/include
- name: Install dependencies
working-directory: ${{ env.WORKING_DIRECTORY }}
run: bun install
- name: Build TypeScript bundle
working-directory: ${{ env.WORKING_DIRECTORY }}
run: bun run build:ts
- name: Download linux-x64 artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.APP_NAME }}-linux-x64
path: ${{ env.WORKING_DIRECTORY }}
- name: Download linux-arm64 artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.APP_NAME }}-linux-arm64
path: ${{ env.WORKING_DIRECTORY }}
- name: Publish to registry
working-directory: ${{ env.WORKING_DIRECTORY }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_CONFIG_TOKEN: ${{ secrets.NPM_REGISTRY_AUTH_TOKEN }}
run: bun publish --registry ${{ env.REGISTRY_URL }} --access public