Skip to content

Build and Release

Build and Release #12

Workflow file for this run

name: Build and Release
on:
push:
tags:
- 'v*'
- '[0-9]*'
workflow_dispatch:
permissions:
contents: write
jobs:
build-linux:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: '6.8'
host: 'linux'
target: 'desktop'
arch: 'linux_gcc_64'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential libgl1-mesa-dev libvulkan-dev \
libxkbcommon-dev libxkbcommon-x11-dev \
libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev \
libxcb-randr0-dev libxcb-render-util0-dev libxcb-xinerama0-dev \
libxcb-xinput-dev libxcb-xfixes0-dev libxcb-shape0-dev \
libxcb-cursor-dev libxcb-util-dev ninja-build
- name: Configure CMake
run: cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$QT_ROOT_DIR
- name: Build
run: cmake --build build
- name: Install linuxdeployqt
run: |
wget https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage
chmod +x linuxdeployqt-continuous-x86_64.AppImage
- name: Create AppImage
run: |
# Create staging directory
mkdir -p AppDir/usr/bin
mkdir -p AppDir/usr/share/applications
mkdir -p AppDir/usr/share/icons/hicolor/512x512/apps
# Copy binaries and resources
cp build/src/vchar64 AppDir/usr/bin/
cp moe.retro.vchar64.desktop AppDir/usr/share/applications/vchar64.desktop
cp src/res/logo512.png AppDir/usr/share/icons/hicolor/512x512/apps/vchar64.png
# Copy libxcb-cursor0 manually as it's required by Qt 6.5+ but often missing from older distros/linuxdeployqt bundles
mkdir -p AppDir/usr/lib
find /usr/lib -name "libxcb-cursor.so.0*" -exec cp {} AppDir/usr/lib/ \;
# Use linuxdeployqt to build AppImage
# -unsupported-allow-new-glibc is needed because we are running on Ubuntu 22.04
# We explicitly add Wayland plugins to ensure they are bundled.
./linuxdeployqt-continuous-x86_64.AppImage AppDir/usr/share/applications/vchar64.desktop \
-appimage -qmake=$QT_ROOT_DIR/bin/qmake \
-extra-plugins=platforms/libqwayland-generic.so,platforms/libqwayland-egl.so \
-verbose=2
# Rename the output AppImage
mv VChar64-*-x86_64.AppImage vchar64-linux-x86_64.AppImage
- name: Upload Release Asset
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: vchar64-linux-x86_64.AppImage
build-windows:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: '6.8'
host: 'windows'
target: 'desktop'
arch: 'win64_msvc2022_64'
- name: Configure CMake
run: cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$env:QT_ROOT_DIR
- name: Build
run: cmake --build build --config Release
- name: Run windeployqt
shell: cmd
run: |
cd build\Release
windeployqt vchar64.exe
- name: Pack
shell: pwsh
run: |
cd build/Release
Compress-Archive -Path * -DestinationPath ../../vchar64-windows.zip
- name: Upload Release Asset
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: vchar64-windows.zip
build-macos:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: '6.8'
host: 'mac'
target: 'desktop'
arch: 'clang_64'
- name: Install Ninja
run: brew install ninja
- name: Configure CMake
run: cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_PREFIX_PATH=$QT_ROOT_DIR
- name: Build
run: cmake --build build --config Release
- name: Run macdeployqt
run: |
cd build/src
macdeployqt vchar64.app -dmg
- name: Rename and Move DMG
run: |
cd build/src
mv vchar64.dmg ../../vchar64-macos.dmg
- name: Upload Release Asset
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: vchar64-macos.dmg