From dc330879be2026bcf728794dc18ef801d68f909d Mon Sep 17 00:00:00 2001 From: Jakub Melka Date: Tue, 2 Jul 2024 11:17:31 +0200 Subject: [PATCH] Add workflow --- .github/workflows/WindowsInstall.yml | 107 +++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 .github/workflows/WindowsInstall.yml diff --git a/.github/workflows/WindowsInstall.yml b/.github/workflows/WindowsInstall.yml new file mode 100644 index 0000000..585c6a7 --- /dev/null +++ b/.github/workflows/WindowsInstall.yml @@ -0,0 +1,107 @@ +name: Windows_MSI + +on: + push: + tags: + - 'v*' + + workflow_dispatch: + +jobs: + build_windows: + runs-on: windows-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + path: pdf4qt + + - name: 'VCPKG: Set up VCPKG' + run: | + git clone --depth=1 https://github.com/microsoft/vcpkg.git + cd vcpkg + .\bootstrap-vcpkg.bat -disableMetrics + .\vcpkg integrate install + set VCPKG_ROOT=${env:GITHUB_WORKSPACE}\vcpkg\ + set "VCPKG_BINARY_SOURCES=clear;files,${env:GITHUB_WORKSPACE}\vcpkg\archives,readwrite" + + - name: 'VCPKG: Cache vcpkg dependencies' + uses: actions/cache@v4 + with: + path: | + ./vcpkg/downloads + ./vcpkg/packages + ./vcpkg/installed + ./vcpkg/archives + key: ${{ runner.os }}-vcpkg-${{ hashFiles('**/vcpkg.json') }} + + + - name: 'VCPKG: Install project dependencies' + run: | + .\vcpkg install tbb openssl lcms zlib openjpeg freetype ijg-libjpeg libpng blend2d --triplet x64-windows + working-directory: vcpkg + + - name: Install Qt + uses: jurplel/install-qt-action@v3 + with: + version: '6.7.2' + host: 'windows' + target: 'desktop' + dir: '${{ github.workspace }}/qt/' + install-deps: 'true' + modules: 'qtspeech qtmultimedia' + cache: 'true' + cache-key-prefix: ${{ runner.os }}-qt-672 + + - name: Build project + working-directory: pdf4qt + shell: pwsh + run: | + cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_VCPKG_BUILD_TYPE=Release -DPDF4QT_INSTALL_QT_DEPENDENCIES=ON -DPDF4QT_INSTALL_DEPENDENCIES=ON -DCMAKE_TOOLCHAIN_FILE="${env:GITHUB_WORKSPACE}\vcpkg\scripts\buildsystems\vcpkg.cmake" -DPDF4QT_QT_ROOT="${env:Qt6_DIR}" -DPDF4QT_INSTALL_MSVC_REDISTRIBUTABLE=ON -DPDF4QT_INSTALL_PREPARE_WIX_INSTALLER=ON -DPDF4QT_INSTALL_TO_USR=ON + cmake --build build --config Release -j6 + cmake --install build + + - name: Read version + id: get_version + run: | + version=$(cat ".\pdf4qt\build\version.txt") + echo "Version: $version" + echo "pdf4qt_version=$version" >> $GITHUB_ENV + env: + pdf4qt_version: ${{ env.pdf4qt_version }} + + - name: Install WiX Toolset + run: choco install wix + + - name: Create MSIX Package + run: | + MakeAppx pack /d ".\pdf4qt\build\install\usr\bin" /p ".\pdf4qt\build\install\JakubMelka.PDF4QT_${{ env.pdf4qt_version }}.msix" + + - name: Create MSI Package + working-directory: pdf4qt\WixInstaller + run: | + candle -d"SolutionDir=." -d"SolutionExt=.sln" -d"SolutionFileName=PDF4QT.sln" -d"SolutionName=PDF4QT" -d"SolutionPath=PDF4QT.sln" -d"Configuration=Release" -d"OutDir=bin\Release\" -d"Platform=x86" -d"ProjectDir=." -d"ProjectExt=.wixproj" -d"ProjectFileName=PDF4QT.wixproj" -d"ProjectName=PDF4QT" -d"ProjectPath=PDF4QT.wixproj" -d"TargetDir=bin\Release\" -d"TargetExt=.msi" -d"TargetFileName=PDF4QT.msi" -d"TargetName=PDF4QT" -d"TargetPath=bin\Release\PDF4QT.msi" -out obj\Release\ -arch x86 -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\\WixUIExtension.dll" Product.wxs + Light -out .\pdf4qt\build\install\PDF4QT.msi -pdbout .\bin\Release\PDF4QT.wixpdb -cultures:null -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\\WixUIExtension.dll" -contentsfile obj\Release\PDF4QT.wixproj.BindContentsFileListnull.txt -outputsfile obj\Release\PDF4QT.wixproj.BindOutputsFileListnull.txt -builtoutputsfile obj\Release\PDF4QT.wixproj.BindBuiltOutputsFileListnull.txt -wixprojectfile .\PDF4QT.wixproj obj\Release\Product.wixobj + + + - name: Upload ZIP directory + uses: actions/upload-artifact@v4 + with: + name: 'pdf4qt-${{ runner.os }}.zip' + path: .\pdf4qt\build\install\usr\bin + retention-days: 30 + + - name: Upload MSIX package + uses: actions/upload-artifact@v4 + with: + name: 'JakubMelka.PDF4QT_${{ env.pdf4qt_version }}.msix' + path: .\pdf4qt\build\install\JakubMelka.PDF4QT_${{ env.pdf4qt_version }}.msix + retention-days: 30 + + - name: Upload MSI package + uses: actions/upload-artifact@v4 + with: + name: 'JakubMelka.PDF4QT_${{ env.pdf4qt_version }}.msi' + path: .\pdf4qt\build\install\PDF4QT.msi + retention-days: 30 \ No newline at end of file