Skip to content

fix(ci): CrashHandler portability for Linux/macOS #9

fix(ci): CrashHandler portability for Linux/macOS

fix(ci): CrashHandler portability for Linux/macOS #9

Workflow file for this run

name: Build NotepadAI
on:
workflow_dispatch:
push:
# branches:
# - master
tags:
- '*'
# pull_request:
env:
QT_RELEASE_VER: 6.5
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, windows-latest, macos-latest]
qt_version: ["6.5", "6.8", "6.10"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
uses: actions/checkout@v6
- name: Sync VERSION to tag
if: startsWith(github.ref, 'refs/tags/v')
shell: bash
run: |
VER="${GITHUB_REF_NAME#v}"
if [[ "$OSTYPE" == darwin* ]]; then
sed -i '' 's/^\([[:space:]]*VERSION[[:space:]]*\).*/\1'"$VER"'/' CMakeLists.txt
else
sed -i 's/^\([[:space:]]*VERSION[[:space:]]*\).*/\1'"$VER"'/' CMakeLists.txt
fi
grep -n '^[[:space:]]*VERSION' CMakeLists.txt
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: ${{ matrix.qt_version }}
modules: 'qt5compat'
cache: true
- name: Setup Visual Studio Tools
if: runner.os == 'Windows'
uses: egor-tensin/vs-shell@v2
with:
arch: x64
- name: Install NSIS
if: runner.os == 'Windows'
uses: repolevedavaj/install-nsis@v1.2.0
with:
nsis-version: '3.11'
- name: Setup Linux
if: runner.os == 'Linux'
run: |
echo "DISTRIBUTION=AppImage" >> "$GITHUB_ENV"
# Qt 6.10+ renamed wayland plugins
if [[ "${{ matrix.qt_version }}" == "6.10" ]]; then
echo "EXTRA_PLATFORM_PLUGINS=libqwayland.so" >> "$GITHUB_ENV"
else
echo "EXTRA_PLATFORM_PLUGINS=libqwayland-generic.so" >> "$GITHUB_ENV"
fi
sudo apt-get install libxkbcommon-dev libxkbcommon-x11-0 fuse libxcb-cursor-dev libcups2-dev
- name: Configure
run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DAPP_DISTRIBUTION=${{ env.DISTRIBUTION }}
- name: Build
run: cmake --build build --parallel
- name: Build Windows Targets
if: runner.os == 'Windows'
run: cmake --build build --target package zip installer --parallel
- name: Build MacOS Targets
if: runner.os == 'macOS'
run: cmake --build build --target dmg --parallel
- name: Build Linux Targets
if: runner.os == 'Linux'
run: cmake --build build --target appimage --parallel
- name: Upload Windows zip Package
uses: actions/upload-artifact@v6
if: runner.os == 'Windows'
with:
name: NotepadAI-Windows-Qt${{ matrix.qt_version }}-Zip
path: ${{ github.workspace }}/build/package/
- name: Upload Windows Installer
uses: actions/upload-artifact@v6
if: runner.os == 'Windows'
with:
name: NotepadAI-Windows-Qt${{ matrix.qt_version }}-Installer
path: ${{ github.workspace }}/installer/NotepadAI*.exe
- name: Upload MacOS dmg
uses: actions/upload-artifact@v6
if: runner.os == 'macOS'
with:
name: NotepadAI-macOS-Qt${{ matrix.qt_version }}
path: ${{ github.workspace }}/build/NotepadAI*.dmg
- name: Upload Linux AppImage
uses: actions/upload-artifact@v6
if: runner.os == 'Linux'
with:
name: NotepadAI-Linux-Qt${{ matrix.qt_version }}-AppImage
path: ${{ github.workspace }}/build/NotepadAI*.AppImage
github:
name: Draft GitHub Release
runs-on: ubuntu-latest
needs: [build]
if: github.repository == 'nullmastermind/NotepadAI' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout Repository
uses: actions/checkout@v6
- name: Create Draft Release
run: |
gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --generate-notes --draft
- name: Download all artifacts
uses: actions/download-artifact@v7
- name: Upload Windows Installer
run: |
gh release upload ${{ github.ref_name }} NotepadAI-Windows-Qt$QT_RELEASE_VER-Installer/NotepadAI-${{ github.ref_name }}-Installer.exe
# The artifact is unzipped, so need to zip it back up so it can be uploaded
- name: Upload Windows Zip
run: |
cd NotepadAI-Windows-Qt$QT_RELEASE_VER-Zip/
zip -r ../NotepadAI-${{ github.ref_name }}-win64.zip .
cd ..
gh release upload ${{ github.ref_name }} NotepadAI-${{ github.ref_name }}-win64.zip
- name: Upload Linux AppImage
run: |
gh release upload ${{ github.ref_name }} NotepadAI-Linux-Qt$QT_RELEASE_VER-AppImage/NotepadAI-${{ github.ref_name }}-x86_64.AppImage
- name: Upload macOS App
run: |
gh release upload ${{ github.ref_name }} NotepadAI-macOS-Qt$QT_RELEASE_VER/NotepadAI-${{ github.ref_name }}.dmg