Windows-pack.yml 8.7 KB

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