Windows-pack.yml 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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. If ($env:TYPE -eq "installer")
  117. {
  118. cpack -G WIX -B "$env:GITHUB_WORKSPACE\build\Package"
  119. }
  120. ElseIf($env:TYPE -eq "portable")
  121. {
  122. cpack -G ZIP -B "$env:GITHUB_WORKSPACE\build\Package"
  123. }
  124. env:
  125. TYPE: ${{matrix.type}}
  126. - name: Package Clean
  127. shell: pwsh
  128. run: |
  129. Remove-Item $env:GITHUB_WORKSPACE\build\Package\_CPack_Packages -Recurse
  130. New-Item -Path $env:GITHUB_WORKSPACE\build\Package\installer -ItemType Directory
  131. New-Item -Path $env:GITHUB_WORKSPACE\build\Package\portable -ItemType Directory
  132. - name: Package Prepare (installer)
  133. if: matrix.type == 'installer'
  134. shell: pwsh
  135. run: |
  136. 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
  137. - name: Package Prepare (portable)
  138. if: matrix.type == 'portable'
  139. shell: pwsh
  140. run: |
  141. 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
  142. - name: SHA256Sum of Windows installer(daily build)
  143. if: matrix.type == 'installer'
  144. shell: bash
  145. run: |
  146. sha256sum $GITHUB_WORKSPACE/build/Package/installer/Flameshot-${VERSION}-${{ matrix.config.pak_arch }}.msi
  147. 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
  148. python -m pip install -U -q requests
  149. echo "============Windows installer sha256sum download link============"
  150. echo $(python $GITHUB_WORKSPACE/scripts/upload_services/transferwee.py upload $GITHUB_WORKSPACE/build/Package/installer/Flameshot-${VERSION}-${{ matrix.config.pak_arch }}.msi.sha256sum)
  151. echo "=======no operation for you can see link in the log console====="
  152. - name: SHA256Sum of Windows portable(daily build)
  153. if: matrix.type == 'portable'
  154. shell: bash
  155. run: |
  156. sha256sum $GITHUB_WORKSPACE/build/Package/portable/flameshot-${VERSION}-${{ matrix.config.pak_arch }}.zip
  157. 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
  158. python -m pip install -U -q requests
  159. echo "===========Windows portable sha256sum download link============"
  160. echo $(python $GITHUB_WORKSPACE/scripts/upload_services/transferwee.py upload $GITHUB_WORKSPACE/build/Package/portable/flameshot-${VERSION}-${{ matrix.config.pak_arch }}.zip.sha256sum)
  161. echo "=====no operation for you can see link in the log console====="
  162. - name: Upload Windows installer(daily build)
  163. if: matrix.type == 'installer'
  164. shell: bash
  165. run: |
  166. python -m pip install -U -q requests
  167. echo "================Windows installer download link================"
  168. echo $(python $GITHUB_WORKSPACE/scripts/upload_services/transferwee.py upload $GITHUB_WORKSPACE/build/Package/installer/Flameshot-${VERSION}-${{ matrix.config.pak_arch }}.msi)
  169. echo "=====no operation for you can see link in the log console====="
  170. - name: Upload Windows portable(daily build)
  171. if: matrix.type == 'portable'
  172. shell: bash
  173. run: |
  174. python -m pip install -U -q requests
  175. echo "=================Windows portable download link================"
  176. echo $(python $GITHUB_WORKSPACE/scripts/upload_services/transferwee.py upload $GITHUB_WORKSPACE/build/Package/portable/flameshot-${VERSION}-${{ matrix.config.pak_arch }}.zip)
  177. echo "=====no operation for you can see link in the log console====="
  178. - name: Artifact Upload
  179. uses: actions/upload-artifact@v2
  180. with:
  181. name: Windows-artifact
  182. path: ${{ github.workspace }}/build/Package/*