build.yml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. name: MSBuild
  2. on:
  3. push:
  4. branches:
  5. - master
  6. paths-ignore:
  7. - '**/*.md'
  8. env:
  9. SOLUTION_FILE_PATH: CP_Main_10.sln
  10. jobs:
  11. build:
  12. runs-on: windows-latest
  13. steps:
  14. - uses: actions/checkout@v4
  15. - name: Generate build number
  16. id: buildnumber
  17. uses: onyxmueller/build-tag-number@v1
  18. with:
  19. token: ${{secrets.GITHUB_TOKEN}}
  20. - name: Set the value
  21. run: |
  22. echo "VERSION_FILENAME=3_25_${env:BUILD_NUMBER}_0" | Out-File -FilePath $env:GITHUB_ENV -Append
  23. echo "VERSION_DOT_FILENAME=3.25.${env:BUILD_NUMBER}.0" | Out-File -FilePath $env:GITHUB_ENV -Append
  24. - name: Add MSBuild to PATH
  25. uses: microsoft/setup-msbuild@v2
  26. - name: Restore NuGet packages
  27. working-directory: ${{env.GITHUB_WORKSPACE}}
  28. run: nuget restore ${{env.SOLUTION_FILE_PATH}}
  29. - name: Build
  30. run: msbuild CP_Main_10.sln /p:Configuration=Release /p:Platform=x64
  31. - name: Set Versions
  32. run: |
  33. DittoSetup\rcedit-x64 Release64\Ditto.exe --set-file-version ${{env.VERSION_DOT_FILENAME}} --set-product-version ${{env.VERSION_DOT_FILENAME}}
  34. - name: upload-unsigned-exe
  35. id: upload-unsigned-exe
  36. uses: actions/upload-artifact@v4
  37. with:
  38. name: unsigned-exe
  39. retention-days: 1
  40. path: |
  41. Release64\Ditto.exe
  42. Release64\ICU_Loader.dll
  43. Release64\Addins\DittoUtil.dll
  44. - id: sign-exe
  45. uses: signpath/[email protected]
  46. with:
  47. api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
  48. organization-id: 'fcf33ea4-4343-46b3-be50-f8fe64e1a900'
  49. project-slug: 'Ditto'
  50. artifact-configuration-slug: 'exe'
  51. signing-policy-slug: 'release-signing'
  52. github-artifact-id: '${{ steps.upload-unsigned-exe.outputs.artifact-id }}'
  53. wait-for-completion: true
  54. output-artifact-directory: '/Release64'
  55. - name: Installer
  56. uses: Minionguyjpro/[email protected]
  57. with:
  58. path: DittoSetup\DittoSetup_10.iss
  59. options: /F"DittoSetup_${{env.VERSION_FILENAME}}" "/dbit64=1"
  60. - name: upload-unsigned-artifact
  61. id: upload-unsigned-artifact
  62. uses: actions/upload-artifact@v4
  63. with:
  64. name: unsigned-intaller
  65. retention-days: 1
  66. path: DittoSetup\output\DittoSetup_${{env.VERSION_FILENAME}}.exe
  67. - id: sing-installer
  68. uses: signpath/[email protected]
  69. with:
  70. api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
  71. organization-id: 'fcf33ea4-4343-46b3-be50-f8fe64e1a900'
  72. project-slug: 'Ditto'
  73. artifact-configuration-slug: 'Installer'
  74. signing-policy-slug: 'release-signing'
  75. github-artifact-id: '${{ steps.upload-unsigned-artifact.outputs.artifact-id }}'
  76. wait-for-completion: true
  77. output-artifact-directory: '/DittoSetup/output'
  78. - name: Build Portable
  79. run: |
  80. DittoSetup\BuildPortableZIP.bat "DittoPortable_${{env.VERSION_FILENAME}}" bit64
  81. - name: Zip Debug Files
  82. run: |
  83. 7z a DittoSetup\output\DittoDebug_${{env.VERSION_FILENAME}}.7z *.pdb -r
  84. 7z a DittoSetup\output\DittoDebug_${{env.VERSION_FILENAME}}.7z *.map -r
  85. - name: Choco - Ditto
  86. run: |
  87. (Get-Content 'DittoSetup\Chocolatey\ditto.nuspec' -Raw).Replace("%version%", "${{env.VERSION_DOT_FILENAME}}") | Out-File 'DittoSetup\Chocolatey\ditto.nuspec'
  88. copy DittoSetup\Output\DittoSetup_${{env.VERSION_FILENAME}}.exe DittoSetup\Chocolatey\tools\DittoSetup_${{env.VERSION_FILENAME}}.exe
  89. cd DittoSetup\Chocolatey
  90. choco pack
  91. choco push --source https://push.chocolatey.org/ --key ${{ secrets.CHOCO_API_KEY}}
  92. cd ..
  93. cd ..
  94. - name: Choco - Ditto.Install
  95. run: |
  96. (Get-Content 'DittoSetup\Chocolatey.install\ditto.nuspec' -Raw).Replace("%version%", "${{env.VERSION_DOT_FILENAME}}") | Out-File 'DittoSetup\Chocolatey.install\ditto.nuspec'
  97. copy DittoSetup\output\DittoSetup_${{env.VERSION_FILENAME}}.exe DittoSetup\Chocolatey.install\tools\DittoSetup_${{env.VERSION_FILENAME}}.exe
  98. cd DittoSetup\Chocolatey.install
  99. choco pack
  100. choco push --source https://push.chocolatey.org/ --key ${{ secrets.CHOCO_API_KEY}}
  101. cd ..
  102. cd ..
  103. - name: Choco - Ditto.Portable
  104. run: |
  105. (Get-Content 'DittoSetup\Chocolatey.portable\ditto.nuspec' -Raw).Replace("%version%", "${{env.VERSION_DOT_FILENAME}}") | Out-File 'DittoSetup\Chocolatey.portable\ditto.nuspec'
  106. copy DittoSetup\output\DittoPortable_${{env.VERSION_FILENAME}}.zip DittoSetup\Chocolatey.portable\tools\DittoPortable_${{env.VERSION_FILENAME}}.zip
  107. cd DittoSetup\Chocolatey.portable
  108. choco pack
  109. choco push --source https://push.chocolatey.org/ --key ${{ secrets.CHOCO_API_KEY}}
  110. cd ..
  111. cd ..
  112. - name: Build appx
  113. run: |
  114. 7z x DittoSetup\output\DittoPortable_${{env.VERSION_FILENAME}}.zip -oDittoSetup\appx -r
  115. (Get-Content 'DittoSetup\appx\appxmanifest.xml' -Raw).Replace("%version%", "${{env.VERSION_DOT_FILENAME}}") | Out-File 'DittoSetup\appx\appxmanifest.xml'
  116. cd DittoSetup\appx
  117. $env:Path += ";C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86"
  118. makeappx.exe pack /f files.ini /p Ditto_${{env.VERSION_FILENAME}}.appx
  119. signtool.exe sign -f my.pfx -fd SHA256 -v Ditto_${{env.VERSION_FILENAME}}.appx
  120. cd ..
  121. cd ..
  122. copy DittoSetup\appx\Ditto_${{env.VERSION_FILENAME}}.appx DittoSetup\Output\Ditto_${{env.VERSION_FILENAME}}.appx
  123. - name: Publish to GitHub
  124. env:
  125. token: ${{secrets.GITHUB_TOKEN}}
  126. uploadPath: DittoSetup\output\
  127. tag: ${{env.VERSION_FILENAME}}
  128. previous_tag: 3.25.73.0
  129. run: |
  130. npm install ./DittoSetup/GitHubRelease
  131. node ./DittoSetup/GitHubRelease/index.js