Windows-pack.yml 8.6 KB

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