windows-publish.yml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. name: Windows build and publish
  2. # This workflow uses actions that are not certified by GitHub.
  3. # They are provided by a third-party and are governed by
  4. # separate terms of service, privacy policy, and support
  5. # documentation.
  6. on:
  7. push:
  8. branches: [ "beta" ]
  9. # Publish semver tags as releases.
  10. tags: [ 'v*.*.*' ]
  11. pull_request:
  12. branches: [ "master" ]
  13. env:
  14. # Use docker.io for Docker Hub if empty
  15. REGISTRY: docker.io
  16. # github.repository as <account>/<repo>
  17. IMAGE_NAME: ${{ github.repository }}
  18. jobs:
  19. build:
  20. runs-on: windows-2019
  21. outputs:
  22. name: ${{ steps.exe-name.outputs.EXENAME }}
  23. defaults:
  24. run:
  25. shell: C:\tools\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}'
  26. steps:
  27. - name: Set up Cygwin
  28. uses: egor-tensin/setup-cygwin@v4
  29. with:
  30. packages: make gcc-g++ zlib-devel
  31. - name: Set git to use LF
  32. shell: pwsh
  33. run: |
  34. git config --global core.autocrlf false
  35. git config --global core.eol lf
  36. - name: Check out code
  37. uses: actions/checkout@v1
  38. with:
  39. submodules: true
  40. - name: Get current time
  41. id: time1
  42. uses: Kaven-Universe/github-action-current-date-time@v1
  43. with:
  44. format: "YYYYMMDD-HHmmss"
  45. timezone-offset: -480
  46. - uses: benjlevesque/short-sha@v2.2
  47. id: short-sha
  48. with:
  49. length: 6
  50. - name: Generate artifact name
  51. id: exe-name
  52. run: |
  53. echo "$GITHUB_OUTPUT"
  54. echo "EXENAME=$EXENAME" >> "$GITHUB_OUTPUT"
  55. env:
  56. EXENAME: paotin-for-windows-setup-${{ steps.time1.outputs.time }}-B${{ github.run_number }}-g${{ steps.short-sha.outputs.sha }}.exe
  57. - name: Install PCRE
  58. run: |
  59. cd $(cygpath $GITHUB_WORKSPACE)
  60. curl -sL https://sourceforge.net/projects/pcre/files/pcre/8.45/pcre-8.45.tar.bz2/download | tar jxvf -
  61. (cd pcre-8.45 && ./configure --enable-unicode-properties --prefix=$(pwd)/usr LDFLAGS=-static && make && make install)
  62. - name: Compile
  63. env:
  64. CFLAGS: -I../../pcre-8.45/usr/include
  65. CPPFLAGS: -I../../pcre-8.45/usr/include
  66. LDFLAGS: -static -L../../pcre-8.45/usr/lib
  67. run: |
  68. cd $(cygpath $GITHUB_WORKSPACE)
  69. (cd tintin/src && ./configure && make && strip tt++ || cat config.log)
  70. - name: Check TinTin++
  71. run: |
  72. cd $(cygpath $GITHUB_WORKSPACE)
  73. ls -lh tintin/src/tt++
  74. file tintin/src/tt++
  75. ldd tintin/src/tt++
  76. tintin/src/tt++ -V || true
  77. - name: Packaging
  78. run: |
  79. cd $(cygpath $GITHUB_WORKSPACE)
  80. cp tintin/src/tt++.exe bin/
  81. cp /bin/cygwin1.dll bin/
  82. rm -rf .git
  83. rm -rf .github
  84. rm -rf tintin
  85. rm -rf pcre-8.45
  86. - name: Create installer
  87. uses: joncloud/makensis-action@v4
  88. with:
  89. script-file: install.nsi
  90. arguments: "/V3"
  91. - name: Rename installer
  92. run: |
  93. cd $(cygpath $GITHUB_WORKSPACE)
  94. mv setup.exe ${{ steps.exe-name.outputs.EXENAME }}
  95. - name: Create artifact -- PaoTin++ Installer
  96. uses: actions/upload-artifact@v3
  97. with:
  98. name: ${{ steps.exe-name.outputs.EXENAME }}
  99. path: ${{ steps.exe-name.outputs.EXENAME }}
  100. - name: Create artifact -- WinTin++
  101. uses: actions/upload-artifact@v3
  102. with:
  103. name: WinTin++
  104. path: |
  105. ${{ github.workspace }}/bin/tt++.exe
  106. ${{ github.workspace }}/bin/cygwin1.dll
  107. - name: Release
  108. uses: softprops/action-gh-release@v1
  109. if: startsWith(github.ref, 'refs/tags/')
  110. with:
  111. files: |
  112. ${{ github.workspace }}/tintin/src/tt++.exe
  113. ${{ github.workspace }}/README.md
  114. publish:
  115. runs-on: ubuntu-latest
  116. needs: build
  117. steps:
  118. - name: Retrieve artifact files
  119. uses: actions/download-artifact@v3
  120. with:
  121. name: ${{ needs.build.outputs.name }}
  122. - name: Send to file server
  123. uses: appleboy/scp-action@v0.1.4
  124. with:
  125. host: ${{ secrets.FILE_SERVER_HOST }}
  126. port: ${{ secrets.FILE_SERVER_PORT }}
  127. username: ${{ secrets.FILE_SERVER_USER }}
  128. key: ${{ secrets.FILE_SERVER_KEY }}
  129. source: ${{ needs.build.outputs.name }}
  130. target: ${{ secrets.FILE_SERVER_ROOT }}/Windows/