release.yml 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. name: release
  2. on:
  3. schedule:
  4. - cron: '5 5 * * *'
  5. workflow_dispatch:
  6. inputs:
  7. tag_name:
  8. description: 'Tag name for release'
  9. required: false
  10. default: nightly
  11. push:
  12. tags:
  13. - v[0-9]+.[0-9]+.[0-9]+
  14. # Build on the oldest supported images, so we have broader compatibility
  15. # Build with gcc-10 to prevent triggering #14150 (default is still gcc-9 on 20.04)
  16. jobs:
  17. setup:
  18. runs-on: ubuntu-latest
  19. outputs:
  20. build_type: ${{ steps.build.outputs.build_type }}
  21. appimage_tag: ${{ steps.build.outputs.appimage_tag }}
  22. steps:
  23. # Nightly uses RelWithDebInfo while stable uses Release (which disables
  24. # asserts). This helps get better debug info from people brave enough to
  25. # use the nightly builds.
  26. - if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name != 'nightly')
  27. run: |
  28. echo 'CMAKE_BUILD_TYPE=Release' >> $GITHUB_ENV
  29. echo 'APPIMAGE_TAG=latest' >> $GITHUB_ENV
  30. - if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name == 'nightly')
  31. run: |
  32. echo 'CMAKE_BUILD_TYPE=RelWithDebInfo' >> $GITHUB_ENV
  33. echo 'APPIMAGE_TAG=nightly' >> $GITHUB_ENV
  34. - name: Export build information
  35. id: build
  36. run: |
  37. printf "build_type=${CMAKE_BUILD_TYPE}\n" >> $GITHUB_OUTPUT
  38. printf "appimage_tag=${APPIMAGE_TAG}\n" >> $GITHUB_OUTPUT
  39. linux:
  40. runs-on: ubuntu-20.04
  41. needs: setup
  42. env:
  43. CC: gcc-10
  44. outputs:
  45. version: ${{ steps.build.outputs.version }}
  46. steps:
  47. - uses: actions/checkout@v4
  48. with:
  49. # Perform a full checkout #13471
  50. fetch-depth: 0
  51. - run: ./.github/scripts/install_deps.sh
  52. - run: echo "CMAKE_BUILD_TYPE=${{ needs.setup.outputs.build_type }}" >> $GITHUB_ENV
  53. - name: appimage
  54. run: ./scripts/genappimage.sh ${{ needs.setup.outputs.appimage_tag }}
  55. - name: tar.gz
  56. run: cpack --config build/CPackConfig.cmake -G TGZ
  57. - uses: actions/upload-artifact@v4
  58. with:
  59. name: appimage
  60. path: |
  61. build/bin/nvim.appimage
  62. build/bin/nvim.appimage.zsync
  63. retention-days: 1
  64. - uses: actions/upload-artifact@v4
  65. with:
  66. name: nvim-linux64
  67. path: |
  68. build/nvim-linux64.tar.gz
  69. retention-days: 1
  70. - name: Export version
  71. id: build
  72. run: |
  73. printf 'version<<END\n' >> $GITHUB_OUTPUT
  74. ./build/bin/nvim --version | head -n 3 >> $GITHUB_OUTPUT
  75. printf 'END\n' >> $GITHUB_OUTPUT
  76. macos:
  77. needs: setup
  78. strategy:
  79. fail-fast: false
  80. matrix:
  81. runner: [ macos-13, macos-14 ]
  82. include:
  83. - runner: macos-13
  84. arch: x86_64
  85. - runner: macos-14
  86. arch: arm64
  87. runs-on: ${{ matrix.runner }}
  88. env:
  89. MACOSX_DEPLOYMENT_TARGET: 11.0
  90. steps:
  91. - uses: actions/checkout@v4
  92. with:
  93. # Perform a full checkout #13471
  94. fetch-depth: 0
  95. - name: Install dependencies
  96. run: ./.github/scripts/install_deps.sh
  97. - name: Build deps
  98. run: |
  99. cmake -S cmake.deps -B .deps -G Ninja \
  100. -D CMAKE_BUILD_TYPE=${{ needs.setup.outputs.build_type }} \
  101. -D CMAKE_FIND_FRAMEWORK=NEVER
  102. cmake --build .deps
  103. - name: Build neovim
  104. run: |
  105. cmake -B build -G Ninja \
  106. -D CMAKE_BUILD_TYPE=${{ needs.setup.outputs.build_type }} \
  107. -D ENABLE_LIBINTL=OFF \
  108. -D CMAKE_FIND_FRAMEWORK=NEVER
  109. cmake --build build
  110. - name: Package
  111. run: cpack --config build/CPackConfig.cmake
  112. - uses: actions/upload-artifact@v4
  113. with:
  114. name: nvim-macos-${{ matrix.arch }}
  115. path: build/nvim-macos-${{ matrix.arch }}.tar.gz
  116. retention-days: 1
  117. windows:
  118. needs: setup
  119. runs-on: windows-2019
  120. steps:
  121. - uses: actions/checkout@v4
  122. with:
  123. # Perform a full checkout #13471
  124. fetch-depth: 0
  125. - run: .github/scripts/env.ps1
  126. - name: Build deps
  127. run: |
  128. cmake -S cmake.deps -B .deps -G Ninja -DCMAKE_BUILD_TYPE=${{ needs.setup.outputs.build_type }}
  129. cmake --build .deps
  130. - name: build package
  131. run: |
  132. cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=${{ needs.setup.outputs.build_type }}
  133. cmake --build build --target package
  134. - uses: actions/upload-artifact@v4
  135. with:
  136. name: nvim-win64
  137. path: |
  138. build/nvim-win64.msi
  139. build/nvim-win64.zip
  140. retention-days: 1
  141. publish:
  142. needs: [linux, macos, windows]
  143. runs-on: ubuntu-latest
  144. env:
  145. GH_REPO: ${{ github.repository }}
  146. GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  147. permissions:
  148. contents: write
  149. steps:
  150. # Must perform checkout first, since it deletes the target directory
  151. # before running, and would therefore delete the downloaded artifacts
  152. - uses: actions/checkout@v4
  153. - uses: actions/download-artifact@v4
  154. - name: Install dependencies
  155. run: sudo apt-get update && sudo apt-get install -y gettext-base
  156. - if: github.event_name == 'workflow_dispatch'
  157. run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
  158. - if: github.event_name == 'schedule'
  159. run: echo 'TAG_NAME=nightly' >> $GITHUB_ENV
  160. - if: github.event_name == 'push'
  161. run: |
  162. TAG_NAME=${{ github.ref }}
  163. echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV
  164. - if: env.TAG_NAME == 'nightly'
  165. run: |
  166. (echo 'SUBJECT=Nvim development (prerelease) build';
  167. echo 'PRERELEASE=--prerelease') >> $GITHUB_ENV
  168. gh release delete nightly --yes || true
  169. git push origin :nightly || true
  170. - if: env.TAG_NAME != 'nightly'
  171. run: |
  172. (echo 'SUBJECT=Nvim release build';
  173. echo 'PRERELEASE=') >> $GITHUB_ENV
  174. gh release delete stable --yes || true
  175. git push origin :stable || true
  176. # `sha256sum` outputs <sha> <path>, so we cd into each dir to drop the
  177. # containing folder from the output.
  178. - name: Generate Linux64 SHA256 checksums
  179. run: |
  180. cd ./nvim-linux64
  181. sha256sum nvim-linux64.tar.gz > nvim-linux64.tar.gz.sha256sum
  182. echo "SHA_LINUX_64_TAR=$(cat nvim-linux64.tar.gz.sha256sum)" >> $GITHUB_ENV
  183. - name: Generate App Image SHA256 checksums
  184. run: |
  185. cd ./appimage
  186. sha256sum nvim.appimage > nvim.appimage.sha256sum
  187. echo "SHA_APP_IMAGE=$(cat nvim.appimage.sha256sum)" >> $GITHUB_ENV
  188. - name: Generate App Image Zsync SHA256 checksums
  189. run: |
  190. cd ./appimage
  191. sha256sum nvim.appimage.zsync > nvim.appimage.zsync.sha256sum
  192. echo "SHA_APP_IMAGE_ZSYNC=$(cat nvim.appimage.zsync.sha256sum)" >> $GITHUB_ENV
  193. - name: Generate macos x86_64 SHA256 checksums
  194. run: |
  195. cd ./nvim-macos-x86_64
  196. sha256sum nvim-macos-x86_64.tar.gz > nvim-macos-x86_64.tar.gz.sha256sum
  197. echo "SHA_MACOS_X86_64=$(cat nvim-macos-x86_64.tar.gz.sha256sum)" >> $GITHUB_ENV
  198. - name: Generate macos arm64 SHA256 checksums
  199. run: |
  200. cd ./nvim-macos-arm64
  201. sha256sum nvim-macos-arm64.tar.gz > nvim-macos-arm64.tar.gz.sha256sum
  202. echo "SHA_MACOS_ARM64=$(cat nvim-macos-arm64.tar.gz.sha256sum)" >> $GITHUB_ENV
  203. - name: Generate Win64 SHA256 checksums
  204. run: |
  205. cd ./nvim-win64
  206. sha256sum nvim-win64.zip > nvim-win64.zip.sha256sum
  207. echo "SHA_WIN_64_ZIP=$(cat nvim-win64.zip.sha256sum)" >> $GITHUB_ENV
  208. sha256sum nvim-win64.msi > nvim-win64.msi.sha256sum
  209. echo "SHA_WIN_64_MSI=$(cat nvim-win64.msi.sha256sum)" >> $GITHUB_ENV
  210. - name: Publish release
  211. env:
  212. NVIM_VERSION: ${{ needs.linux.outputs.version }}
  213. DEBUG: api
  214. run: |
  215. envsubst < "$GITHUB_WORKSPACE/.github/workflows/notes.md" > "$RUNNER_TEMP/notes.md"
  216. if [ "$TAG_NAME" != "nightly" ]; then
  217. gh release create stable $PRERELEASE --notes-file "$RUNNER_TEMP/notes.md" --title "$SUBJECT" --target $GITHUB_SHA nvim-macos-x86_64/* nvim-macos-arm64/* nvim-linux64/* appimage/* nvim-win64/*
  218. fi
  219. gh release create $TAG_NAME $PRERELEASE --notes-file "$RUNNER_TEMP/notes.md" --title "$SUBJECT" --target $GITHUB_SHA nvim-macos-x86_64/* nvim-macos-arm64/* nvim-linux64/* appimage/* nvim-win64/*