Windows-pack.yml 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. name: Packaging(Windows)
  2. on:
  3. push:
  4. branches:
  5. - master*
  6. paths-ignore:
  7. - 'README.md'
  8. - 'LICENSE'
  9. pull_request:
  10. paths-ignore:
  11. - 'README.md'
  12. - 'LICENSE'
  13. workflow_dispatch:
  14. env:
  15. PRODUCT: flameshot
  16. jobs:
  17. windows-pack:
  18. name: VS 2019 ${{ matrix.config.arch }}-${{ matrix.type }}
  19. runs-on: windows-2019
  20. env:
  21. VCINSTALLDIR: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/
  22. Qt5_DIR: ${{ github.workspace }}\build\Qt\${{ matrix.qt_ver }}\${{ matrix.config.qt_arch_install }}\lib\cmake\Qt5\
  23. QTDIR: ${{ github.workspace }}\build\Qt\${{ matrix.qt_ver }}\${{ matrix.config.qt_arch_install }}\
  24. # 2022.06.15.1
  25. VCPKG_VERSION: cef0b3ec767df6e83806899fe9525f6cf8d7bc91
  26. VCPKG_PACKAGES: openssl-windows
  27. OPENSSL_ROOT_DIR: ${{ github.workspace }}\vcpkg\installed\${{ matrix.config.vcpkg_triplet }}\
  28. strategy:
  29. fail-fast: false
  30. matrix:
  31. qt_ver: [5.15.2]
  32. qt_target: [desktop]
  33. config:
  34. - {
  35. arch: x86,
  36. generator: "-G'Visual Studio 16 2019' -A Win32",
  37. vcpkg_triplet: x86-windows,
  38. qt_arch: win32_msvc2019,
  39. qt_arch_install: msvc2019,
  40. pak_arch: win32
  41. }
  42. - {
  43. arch: x64,
  44. generator: "-G'Visual Studio 16 2019' -A x64",
  45. vcpkg_triplet: x64-windows,
  46. qt_arch: win64_msvc2019_64,
  47. qt_arch_install: msvc2019_64,
  48. pak_arch: win64
  49. }
  50. type: [portable, installer]
  51. steps:
  52. - name: Checkout Source code
  53. if: github.event_name == 'push'
  54. uses: actions/checkout@v4
  55. with:
  56. fetch-depth: 0
  57. # ref: master
  58. - name: Checkout Source code
  59. if: github.event_name == 'pull_request'
  60. uses: actions/checkout@v4
  61. with:
  62. fetch-depth: 0
  63. ref: ${{ github.event.pull_request.head.sha }}
  64. - name: Set env & Print flameshot version
  65. shell: bash
  66. run: |
  67. last_committed_tag=$(git tag -l --sort=-v:refname | head -1)
  68. git_revno=$(git rev-list $(git describe --tags --abbrev=0)..HEAD --count)
  69. git_hash=$(git rev-parse --short HEAD)
  70. echo "=======FLAMESHOT VERSION========"
  71. echo ${last_committed_tag:1}
  72. echo "Details: ${last_committed_tag}+git${git_revno}.${git_hash}"
  73. echo "================================"
  74. # This will allow to build pre-preleases without git tag
  75. # echo "VERSION=${last_committed_tag:1}" >> $GITHUB_ENV
  76. echo "VERSION=$(cat CMakeLists.txt |grep 'set.*(.*FLAMESHOT_VERSION' | sed 's/[^0-9.]*//' |sed 's/)//g')" >> $GITHUB_ENV
  77. - name: Restore from cache and run vcpkg
  78. uses: lukka/run-vcpkg@v7.4
  79. with:
  80. vcpkgArguments: ${{env.VCPKG_PACKAGES}}
  81. vcpkgDirectory: '${{ github.workspace }}\vcpkg'
  82. appendedCacheKey: ${{ matrix.config.vcpkg_triplet }}
  83. vcpkgGitCommitId: ${{ env.VCPKG_VERSION }}
  84. vcpkgTriplet: ${{ matrix.config.vcpkg_triplet }}
  85. - name: Cache Qt
  86. id: cache-qt
  87. uses: actions/cache@v3
  88. with:
  89. path: ./build/Qt/${{ matrix.qt_ver }}/${{ matrix.config.qt_arch_install }}
  90. key: ${{ runner.os }}-QtCache/${{ matrix.qt_ver }}/${{ matrix.config.qt_arch }}
  91. - name: Install Qt
  92. uses: jurplel/install-qt-action@v2
  93. with:
  94. version: ${{ matrix.qt_ver }}
  95. target: ${{ matrix.qt_target }}
  96. arch: ${{ matrix.config.qt_arch }}
  97. dir: '${{ github.workspace }}/build/'
  98. modules: 'qtscript'
  99. cached: ${{ steps.cache-qt.outputs.cache-hit }}
  100. - name: Configure
  101. working-directory: build
  102. shell: pwsh
  103. run: |
  104. cmake .. ${{matrix.config.generator}} `
  105. -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake" `
  106. -DENABLE_OPENSSL=ON `
  107. -DCMAKE_BUILD_TYPE=Release `
  108. -DRUN_IN_PLACE=${{ contains(matrix.type, 'portable') }}
  109. - name: Compile
  110. working-directory: build
  111. shell: pwsh
  112. run: cmake --build . --config Release
  113. - name: CPack
  114. working-directory: build
  115. shell: pwsh
  116. run: |
  117. # Chocolately made their own package called cpack and its first in the path. This is a hack since we are only using cmake's cpack, doesn't seem to be required after a CI update
  118. #Remove-Item C:\ProgramData\Chocolatey\bin\cpack.exe
  119. If ($env:TYPE -eq "installer")
  120. {
  121. cpack -G WIX -B "$env:GITHUB_WORKSPACE\build\Package"
  122. }
  123. ElseIf($env:TYPE -eq "portable")
  124. {
  125. cpack -G ZIP -B "$env:GITHUB_WORKSPACE\build\Package"
  126. }
  127. env:
  128. TYPE: ${{matrix.type}}
  129. - name: Package Clean
  130. shell: pwsh
  131. run: |
  132. # Remove-Item $env:GITHUB_WORKSPACE\build\Package\_CPack_Packages -Recurse
  133. New-Item -Path $env:GITHUB_WORKSPACE\build\Package\installer -ItemType Directory
  134. New-Item -Path $env:GITHUB_WORKSPACE\build\Package\portable -ItemType Directory
  135. - name: Package Prepare (installer)
  136. if: matrix.type == 'installer'
  137. shell: pwsh
  138. run: |
  139. Move-Item -Path $env:GITHUB_WORKSPACE/build/Package/Flameshot-*-${{ matrix.config.pak_arch }}.msi -Destination $env:GITHUB_WORKSPACE/build/Package/installer/Flameshot-$env:VERSION-${{ matrix.config.pak_arch }}.msi
  140. - name: Package Prepare (portable)
  141. if: matrix.type == 'portable'
  142. shell: pwsh
  143. run: |
  144. Move-Item -Path $env:GITHUB_WORKSPACE/build/Package/flameshot-*-${{ matrix.config.pak_arch }}.zip -Destination $env:GITHUB_WORKSPACE/build/Package/portable/flameshot-$env:VERSION-${{ matrix.config.pak_arch }}.zip
  145. - name: SHA256Sum of Windows installer(daily build)
  146. if: matrix.type == 'installer'
  147. shell: bash
  148. run: |
  149. sha256sum $GITHUB_WORKSPACE/build/Package/installer/Flameshot-${VERSION}-${{ matrix.config.pak_arch }}.msi
  150. sha256sum $GITHUB_WORKSPACE/build/Package/installer/Flameshot-${VERSION}-${{ matrix.config.pak_arch }}.msi > $GITHUB_WORKSPACE/build/Package/installer/Flameshot-${VERSION}-${{ matrix.config.pak_arch }}.msi.sha256sum
  151. python -m pip install -U -q requests
  152. echo "============Windows installer sha256sum download link============"
  153. echo $(python $GITHUB_WORKSPACE/scripts/upload_services/transferwee.py upload $GITHUB_WORKSPACE/build/Package/installer/Flameshot-${VERSION}-${{ matrix.config.pak_arch }}.msi.sha256sum)
  154. echo "=======no operation for you can see link in the log console====="
  155. - name: SHA256Sum of Windows portable(daily build)
  156. if: matrix.type == 'portable'
  157. shell: bash
  158. run: |
  159. sha256sum $GITHUB_WORKSPACE/build/Package/portable/flameshot-${VERSION}-${{ matrix.config.pak_arch }}.zip
  160. sha256sum $GITHUB_WORKSPACE/build/Package/portable/flameshot-${VERSION}-${{ matrix.config.pak_arch }}.zip > $GITHUB_WORKSPACE/build/Package/portable/flameshot-${VERSION}-${{ matrix.config.pak_arch }}.zip.sha256sum
  161. python -m pip install -U -q requests
  162. echo "===========Windows portable sha256sum download link============"
  163. echo $(python $GITHUB_WORKSPACE/scripts/upload_services/transferwee.py upload $GITHUB_WORKSPACE/build/Package/portable/flameshot-${VERSION}-${{ matrix.config.pak_arch }}.zip.sha256sum)
  164. echo "=====no operation for you can see link in the log console====="
  165. - name: Upload Windows installer(daily build)
  166. if: matrix.type == 'installer'
  167. shell: bash
  168. run: |
  169. python -m pip install -U -q requests
  170. echo "================Windows installer download link================"
  171. echo $(python $GITHUB_WORKSPACE/scripts/upload_services/transferwee.py upload $GITHUB_WORKSPACE/build/Package/installer/Flameshot-${VERSION}-${{ matrix.config.pak_arch }}.msi)
  172. echo "=====no operation for you can see link in the log console====="
  173. - name: Upload Windows portable(daily build)
  174. if: matrix.type == 'portable'
  175. shell: bash
  176. run: |
  177. python -m pip install -U -q requests
  178. echo "=================Windows portable download link================"
  179. echo $(python $GITHUB_WORKSPACE/scripts/upload_services/transferwee.py upload $GITHUB_WORKSPACE/build/Package/portable/flameshot-${VERSION}-${{ matrix.config.pak_arch }}.zip)
  180. echo "=====no operation for you can see link in the log console====="
  181. - name: Artifact Upload
  182. uses: actions/upload-artifact@v3
  183. with:
  184. name: Windows-artifact
  185. path: ${{ github.workspace }}/build/Package/*