Skip to content

feat: wire module switching, toolbar callbacks and fix Windows build #7

feat: wire module switching, toolbar callbacks and fix Windows build

feat: wire module switching, toolbar callbacks and fix Windows build #7

Workflow file for this run

name: Release
on:
push:
branches: [main]
jobs:
# ── Step 1: Check if the version in CMakeLists.txt is new ───────────────────
check-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
should_release: ${{ steps.tag_check.outputs.should_release }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract version from CMakeLists.txt
id: version
run: |
VERSION=$(grep -oP '(?<=project\(Convoy VERSION )\d+\.\d+\.\d+' CMakeLists.txt)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Detected version: $VERSION"
- name: Check if tag already exists
id: tag_check
run: |
if git rev-parse "v${{ steps.version.outputs.version }}" >/dev/null 2>&1; then
echo "Tag v${{ steps.version.outputs.version }} already exists — skipping release."
echo "should_release=false" >> $GITHUB_OUTPUT
else
echo "New version v${{ steps.version.outputs.version }} — will create release."
echo "should_release=true" >> $GITHUB_OUTPUT
fi
# ── Step 2: Build full graphics executable on both platforms ────────────────
build-release:
needs: check-version
if: needs.check-version.outputs.should_release == 'true'
name: Build ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- name: "Windows"
os: windows-latest
artifact_name: convoy-windows-x86_64
artifact_ext: zip
- name: "Linux"
os: ubuntu-latest
artifact_name: convoy-linux-x86_64
artifact_ext: tar.gz
steps:
- uses: actions/checkout@v4
# ── Windows: GLFW via vcpkg (static-md = static libs + dynamic CRT) ─────
- name: Bootstrap vcpkg (Windows)
if: runner.os == 'Windows'
run: |
if [ ! -d "C:/vcpkg/.git" ]; then
git clone --depth=1 https://github.com/microsoft/vcpkg.git C:/vcpkg
fi
C:/vcpkg/bootstrap-vcpkg.bat -disableMetrics
shell: bash
- name: Cache vcpkg packages (Windows)
if: runner.os == 'Windows'
uses: actions/cache@v4
with:
path: C:/vcpkg/installed
key: vcpkg-windows-${{ hashFiles('vcpkg.json') }}
restore-keys: vcpkg-windows-
- name: Configure CMake (Windows)
if: runner.os == 'Windows'
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake" \
-DVCPKG_TARGET_TRIPLET=x64-windows-static-md
shell: bash
# ── Linux: build GLFW 3.4 from source (Ubuntu apt ships 3.3.x) ──────────
- name: Install build dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake libgl1-mesa-dev xorg-dev wget unzip
- name: Build and install GLFW 3.4 from source (Linux)
if: runner.os == 'Linux'
run: |
wget -q https://github.com/glfw/glfw/releases/download/3.4/glfw-3.4.zip
unzip -q glfw-3.4.zip
cmake -B glfw-build -S glfw-3.4 \
-DGLFW_BUILD_DOCS=OFF \
-DGLFW_BUILD_TESTS=OFF \
-DGLFW_BUILD_EXAMPLES=OFF \
-DGLFW_BUILD_WAYLAND=OFF \
-DCMAKE_BUILD_TYPE=Release
cmake --build glfw-build
sudo cmake --install glfw-build
rm -rf glfw-3.4 glfw-3.4.zip glfw-build
- name: Configure CMake (Linux)
if: runner.os == 'Linux'
run: cmake -B build -DCMAKE_BUILD_TYPE=Release
# ── Build ────────────────────────────────────────────────────────────────
- name: Build
run: cmake --build build --config Release
# ── Verify convoy executable was produced ────────────────────────────────
- name: Verify executable (Windows)
if: runner.os == 'Windows'
run: test -f build/Release/convoy.exe
shell: bash
- name: Verify executable (Linux)
if: runner.os == 'Linux'
run: test -f build/convoy
# ── Package ──────────────────────────────────────────────────────────────
- name: Package (Windows)
if: runner.os == 'Windows'
run: |
mkdir dist
cp build/Release/convoy.exe dist/
7z a convoy-windows-x86_64.zip ./dist/convoy.exe
shell: bash
- name: Package (Linux)
if: runner.os == 'Linux'
run: |
mkdir dist
cp build/convoy dist/
tar -czf convoy-linux-x86_64.tar.gz -C dist convoy
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.config.artifact_name }}
path: ${{ matrix.config.artifact_name }}.${{ matrix.config.artifact_ext }}
# ── Step 3: Create git tag and GitHub Release ────────────────────────────────
create-release:
needs: [check-version, build-release]
if: needs.check-version.outputs.should_release == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create and push git tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag "v${{ needs.check-version.outputs.version }}"
git push origin "v${{ needs.check-version.outputs.version }}"
- name: Download all build artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.check-version.outputs.version }}
name: Convoy v${{ needs.check-version.outputs.version }}
generate_release_notes: true
files: |
artifacts/convoy-windows-x86_64/convoy-windows-x86_64.zip
artifacts/convoy-linux-x86_64/convoy-linux-x86_64.tar.gz