build.yml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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. - name: upload-unsigned-artifact
  60. id: upload-unsigned-artifact
  61. uses: actions/upload-artifact@v4
  62. with:
  63. name: unsigned-intaller
  64. retention-days: 1
  65. path: DittoSetup\output\DittoSetup_${{env.VERSION_FILENAME}}.exe
  66. - id: sing-installer
  67. uses: signpath/[email protected]
  68. with:
  69. api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
  70. organization-id: 'fcf33ea4-4343-46b3-be50-f8fe64e1a900'
  71. project-slug: 'Ditto'
  72. artifact-configuration-slug: 'Installer'
  73. signing-policy-slug: 'release-signing'
  74. github-artifact-id: '${{ steps.upload-unsigned-artifact.outputs.artifact-id }}'
  75. wait-for-completion: true
  76. output-artifact-directory: '/DittoSetup/output'
  77. - name: Build Portable
  78. run: |
  79. DittoSetup\BuildPortableZIP.bat "DittoPortable_${{env.VERSION_FILENAME}}" bit64
  80. - name: Zip Debug Files
  81. run: |
  82. 7z a DittoSetup\output\DittoDebug_${{env.VERSION_FILENAME}}.7z *.pdb -r
  83. 7z a DittoSetup\output\DittoDebug_${{env.VERSION_FILENAME}}.7z *.map -r
  84. - name: Choco - Ditto
  85. run: |
  86. (Get-Content 'DittoSetup\Chocolatey\ditto.nuspec' -Raw).Replace("%version%", "${{env.VERSION_DOT_FILENAME}}") | Out-File 'DittoSetup\Chocolatey\ditto.nuspec'
  87. copy DittoSetup\Output\DittoSetup_${{env.VERSION_FILENAME}}.exe DittoSetup\Chocolatey\tools\DittoSetup_${{env.VERSION_FILENAME}}.exe
  88. cd DittoSetup\Chocolatey
  89. choco pack
  90. choco push --source https://push.chocolatey.org/ --key ${{ secrets.CHOCO_API_KEY}}
  91. cd ..
  92. cd ..
  93. - name: Choco - Ditto.Install
  94. run: |
  95. (Get-Content 'DittoSetup\Chocolatey.install\ditto.nuspec' -Raw).Replace("%version%", "${{env.VERSION_DOT_FILENAME}}") | Out-File 'DittoSetup\Chocolatey.install\ditto.nuspec'
  96. copy DittoSetup\output\DittoSetup_${{env.VERSION_FILENAME}}.exe DittoSetup\Chocolatey.install\tools\DittoSetup_${{env.VERSION_FILENAME}}.exe
  97. cd DittoSetup\Chocolatey.install
  98. choco pack
  99. choco push --source https://push.chocolatey.org/ --key ${{ secrets.CHOCO_API_KEY}}
  100. cd ..
  101. cd ..
  102. - name: Choco - Ditto.Portable
  103. run: |
  104. (Get-Content 'DittoSetup\Chocolatey.portable\ditto.nuspec' -Raw).Replace("%version%", "${{env.VERSION_DOT_FILENAME}}") | Out-File 'DittoSetup\Chocolatey.portable\ditto.nuspec'
  105. copy DittoSetup\output\DittoPortable_${{env.VERSION_FILENAME}}.zip DittoSetup\Chocolatey.portable\tools\DittoPortable_${{env.VERSION_FILENAME}}.zip
  106. cd DittoSetup\Chocolatey.portable
  107. choco pack
  108. choco push --source https://push.chocolatey.org/ --key ${{ secrets.CHOCO_API_KEY}}
  109. cd ..
  110. cd ..
  111. - name: Build appx
  112. run: |
  113. 7z x DittoSetup\output\DittoPortable_${{env.VERSION_FILENAME}}.zip -oDittoSetup\appx -r
  114. (Get-Content 'DittoSetup\appx\appxmanifest.xml' -Raw).Replace("%version%", "${{env.VERSION_DOT_FILENAME}}") | Out-File 'DittoSetup\appx\appxmanifest.xml'
  115. cd DittoSetup\appx
  116. $env:Path += ";C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x86"
  117. makeappx.exe pack /f files.ini /p Ditto_${{env.VERSION_FILENAME}}.appx
  118. signtool.exe sign -f my.pfx -fd SHA256 -v Ditto_${{env.VERSION_FILENAME}}.appx
  119. cd ..
  120. cd ..
  121. copy DittoSetup\appx\Ditto_${{env.VERSION_FILENAME}}.appx DittoSetup\Output\Ditto_${{env.VERSION_FILENAME}}.appx
  122. - name: Publish to GitHub
  123. env:
  124. token: ${{secrets.GITHUB_TOKEN}}
  125. uploadPath: DittoSetup\output\
  126. tag: ${{env.VERSION_FILENAME}}
  127. previous_tag: 3.25.113.0
  128. run: |
  129. npm install ./DittoSetup/GitHubRelease
  130. node ./DittoSetup/GitHubRelease/index.js