release.yml 7.7 KB

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