fix(webview): sync Qt/Win32 focus on WebView2 transitions #46
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 & Release NotepadAI | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - master | |
| concurrency: | |
| group: release | |
| cancel-in-progress: false | |
| jobs: | |
| version: | |
| name: Determine Version | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.bump.outputs.version }} | |
| tag: ${{ steps.bump.outputs.tag }} | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Bump patch version | |
| id: bump | |
| run: | | |
| # Find latest v0.0.* tag | |
| LATEST=$(git tag -l 'v0.0.*' --sort=-v:refname | head -1) | |
| if [ -z "$LATEST" ]; then | |
| # No v0.0.x tags exist yet — start from v0.0.1 | |
| NEW_PATCH=1 | |
| else | |
| PATCH="${LATEST##*.}" | |
| NEW_PATCH=$((PATCH + 1)) | |
| fi | |
| VERSION="0.0.${NEW_PATCH}" | |
| TAG="v${VERSION}" | |
| echo "version=${VERSION}" >> "$GITHUB_OUTPUT" | |
| echo "tag=${TAG}" >> "$GITHUB_OUTPUT" | |
| echo "Next version: ${TAG}" | |
| build: | |
| needs: [version] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-24.04, windows-2022, macos-latest] | |
| qt_version: ["6.5", "6.8", "6.10"] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v6 | |
| - name: Compute Qt suffix | |
| id: qt | |
| shell: bash | |
| run: echo "suffix=qt$(echo '${{ matrix.qt_version }}' | tr -d '.')" >> "$GITHUB_OUTPUT" | |
| - name: Set VERSION in CMakeLists.txt | |
| shell: bash | |
| run: | | |
| VER="${{ needs.version.outputs.version }}" | |
| 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 }} | |
| # qtwayland is included in the base Qt Linux archives; not a valid aqt add-on module | |
| 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: Install WebView2 SDK | |
| if: runner.os == 'Windows' | |
| shell: bash | |
| run: | | |
| curl -sL -o webview2.nupkg "https://www.nuget.org/api/v2/package/Microsoft.Web.WebView2/1.0.3967.48" | |
| unzip -q -o webview2.nupkg -d webview2-sdk | |
| cp webview2-sdk/build/native/include/WebView2.h thirdparty/webview2/include/WebView2.h | |
| cp webview2-sdk/build/native/include/WebView2EnvironmentOptions.h thirdparty/webview2/include/WebView2EnvironmentOptions.h | |
| cp webview2-sdk/runtimes/win-x64/native/WebView2Loader.dll deploy/windows/WebView2Loader.dll | |
| - name: Setup Linux | |
| if: runner.os == 'Linux' | |
| run: | | |
| echo "DISTRIBUTION=AppImage" >> "$GITHUB_ENV" | |
| 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-Zip-${{ steps.qt.outputs.suffix }} | |
| path: ${{ github.workspace }}/build/package/ | |
| - name: Upload Windows Installer | |
| uses: actions/upload-artifact@v6 | |
| if: runner.os == 'Windows' | |
| with: | |
| name: NotepadAI-Windows-Installer-${{ steps.qt.outputs.suffix }} | |
| path: ${{ github.workspace }}/installer/NotepadAI*.exe | |
| - name: Upload MacOS dmg | |
| uses: actions/upload-artifact@v6 | |
| if: runner.os == 'macOS' | |
| with: | |
| name: NotepadAI-macOS-${{ steps.qt.outputs.suffix }} | |
| path: ${{ github.workspace }}/build/NotepadAI*.dmg | |
| - name: Upload Linux AppImage | |
| uses: actions/upload-artifact@v6 | |
| if: runner.os == 'Linux' | |
| with: | |
| name: NotepadAI-Linux-AppImage-${{ steps.qt.outputs.suffix }} | |
| path: ${{ github.workspace }}/build/NotepadAI*.AppImage | |
| release: | |
| name: Publish GitHub Release | |
| runs-on: ubuntu-latest | |
| needs: [version, build] | |
| permissions: | |
| contents: write | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Create and push tag | |
| run: | | |
| git config user.email "action@github.com" | |
| git config user.name "GitHub Action" | |
| git tag ${{ needs.version.outputs.tag }} | |
| git push origin ${{ needs.version.outputs.tag }} | |
| - name: Create Release | |
| run: | | |
| gh release create ${{ needs.version.outputs.tag }} \ | |
| --title "${{ needs.version.outputs.tag }}" \ | |
| --generate-notes | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v7 | |
| - name: Upload release assets | |
| run: | | |
| TAG="${{ needs.version.outputs.tag }}" | |
| for suffix in qt65 qt68 qt610; do | |
| # Windows Installer | |
| mv "NotepadAI-Windows-Installer-${suffix}"/NotepadAI*.exe \ | |
| "NotepadAI-${TAG}-${suffix}-Installer.exe" | |
| gh release upload "$TAG" "NotepadAI-${TAG}-${suffix}-Installer.exe" | |
| # Windows Zip | |
| cd "NotepadAI-Windows-Zip-${suffix}/" | |
| zip -r "../NotepadAI-${TAG}-${suffix}-win64.zip" . | |
| cd .. | |
| gh release upload "$TAG" "NotepadAI-${TAG}-${suffix}-win64.zip" | |
| # Linux AppImage | |
| mv "NotepadAI-Linux-AppImage-${suffix}"/NotepadAI*.AppImage \ | |
| "NotepadAI-${TAG}-${suffix}-x86_64.AppImage" | |
| gh release upload "$TAG" "NotepadAI-${TAG}-${suffix}-x86_64.AppImage" | |
| # macOS dmg | |
| mv "NotepadAI-macOS-${suffix}"/NotepadAI*.dmg \ | |
| "NotepadAI-${TAG}-${suffix}.dmg" | |
| gh release upload "$TAG" "NotepadAI-${TAG}-${suffix}.dmg" | |
| done |