release.yml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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. # Upgrade to gcc-11 to prevent it from using its builtins (#14150)
  16. jobs:
  17. linux:
  18. runs-on: ubuntu-18.04
  19. outputs:
  20. version: ${{ steps.build.outputs.version }}
  21. release: ${{ steps.build.outputs.release }}
  22. steps:
  23. - uses: actions/checkout@v2
  24. with:
  25. fetch-depth: 0
  26. - name: Install dependencies
  27. run: |
  28. sudo apt-get update
  29. sudo apt-get install -y autoconf automake build-essential cmake gcc-11 gettext gperf libtool-bin locales ninja-build pkg-config unzip
  30. - if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name != 'nightly')
  31. run: printf 'NVIM_BUILD_TYPE=Release\n' >> $GITHUB_ENV
  32. - if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name == 'nightly')
  33. run: printf 'NVIM_BUILD_TYPE=RelWithDebInfo\n' >> $GITHUB_ENV
  34. - name: Build release
  35. id: build
  36. run: |
  37. CC=gcc-11 make CMAKE_BUILD_TYPE=${NVIM_BUILD_TYPE} CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX:PATH="
  38. printf '::set-output name=version::%s\n' "$(./build/bin/nvim --version | head -n 3 | sed -z 's/\n/%0A/g')"
  39. printf '::set-output name=release::%s\n' "$(./build/bin/nvim --version | head -n 1)"
  40. make DESTDIR="$GITHUB_WORKSPACE/build/release/nvim-linux64" install
  41. cd "$GITHUB_WORKSPACE/build/"
  42. cpack -C $NVIM_BUILD_TYPE
  43. - uses: actions/upload-artifact@v2
  44. with:
  45. name: nvim-linux64
  46. path: build/nvim-linux64.tar.gz
  47. retention-days: 1
  48. - uses: actions/upload-artifact@v2
  49. with:
  50. name: nvim-linux64
  51. path: build/nvim-linux64.deb
  52. retention-days: 1
  53. appimage:
  54. runs-on: ubuntu-18.04
  55. steps:
  56. - uses: actions/checkout@v2
  57. with:
  58. fetch-depth: 0
  59. - name: Install dependencies
  60. run: |
  61. sudo apt-get update
  62. sudo apt-get install -y autoconf automake build-essential cmake gcc-11 gettext gperf libtool-bin locales ninja-build pkg-config unzip
  63. - if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name != 'nightly')
  64. run: CC=gcc-11 make appimage-latest
  65. - if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name == 'nightly')
  66. run: CC=gcc-11 make appimage-nightly
  67. - uses: actions/upload-artifact@v2
  68. with:
  69. name: appimage
  70. path: build/bin/nvim.appimage
  71. retention-days: 1
  72. - uses: actions/upload-artifact@v2
  73. with:
  74. name: appimage
  75. path: build/bin/nvim.appimage.zsync
  76. retention-days: 1
  77. macOS:
  78. runs-on: macos-11
  79. steps:
  80. - uses: actions/checkout@v2
  81. with:
  82. fetch-depth: 0
  83. - name: Install brew packages
  84. run: |
  85. brew update --quiet
  86. brew install automake ninja
  87. - if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name != 'nightly')
  88. run: printf 'NVIM_BUILD_TYPE=Release\n' >> $GITHUB_ENV
  89. - if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name == 'nightly')
  90. run: printf 'NVIM_BUILD_TYPE=RelWithDebInfo\n' >> $GITHUB_ENV
  91. - name: Provision universal `libintl`
  92. run: |
  93. GETTEXT_PREFIX="$(brew --prefix gettext)"
  94. printf 'GETTEXT_PREFIX=%s\n' "$GETTEXT_PREFIX" >> $GITHUB_ENV
  95. bottle_tag="arm64_big_sur"
  96. brew fetch --bottle-tag="$bottle_tag" gettext
  97. cd "$(mktemp -d)"
  98. tar xf "$(brew --cache)"/**/*gettext*${bottle_tag}*.tar.gz
  99. lipo gettext/*/lib/libintl.a "${GETTEXT_PREFIX}/lib/libintl.a" -create -output libintl.a
  100. mv -f libintl.a /usr/local/lib/
  101. - name: Ensure static linkage to `libintl`
  102. run: |
  103. # We're about to mangle `gettext`, so let's remove any potentially broken
  104. # installs (e.g. curl, git) as those could interfere with our build.
  105. brew uninstall $(brew uses --installed --recursive gettext)
  106. brew unlink gettext
  107. ln -sf "$(brew --prefix)/opt/$(readlink "${GETTEXT_PREFIX}")/bin"/* /usr/local/bin/
  108. ln -sf "$(brew --prefix)/opt/$(readlink "${GETTEXT_PREFIX}")/include"/* /usr/local/include/
  109. rm -f "$GETTEXT_PREFIX"
  110. - name: Build release
  111. run: |
  112. export MACOSX_DEPLOYMENT_TARGET="$(sw_vers -productVersion | cut -f1 -d.)"
  113. OSX_FLAGS="-DCMAKE_OSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} -DCMAKE_OSX_ARCHITECTURES=arm64\;x86_64"
  114. make CMAKE_BUILD_TYPE=${NVIM_BUILD_TYPE} \
  115. CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX:PATH= $OSX_FLAGS" \
  116. DEPS_CMAKE_FLAGS="$OSX_FLAGS -DUSE_BUNDLED_GPERF=OFF"
  117. make DESTDIR="$GITHUB_WORKSPACE/build/release/nvim-macos" install
  118. - name: Create package
  119. run: |
  120. cd "$GITHUB_WORKSPACE/build/release"
  121. tar cfz nvim-macos.tar.gz nvim-macos
  122. - uses: actions/upload-artifact@v3
  123. with:
  124. name: nvim-macos
  125. path: build/release/nvim-macos.tar.gz
  126. retention-days: 1
  127. windows:
  128. runs-on: windows-2019
  129. env:
  130. DEPS_BUILD_DIR: ${{ format('{0}/nvim-deps', github.workspace) }}
  131. DEPS_PREFIX: ${{ format('{0}/nvim-deps/usr', github.workspace) }}
  132. strategy:
  133. matrix:
  134. include:
  135. - config: MSVC_64
  136. archive: nvim-win64
  137. name: windows (${{ matrix.config }})
  138. steps:
  139. - uses: actions/checkout@v2
  140. with:
  141. fetch-depth: 0
  142. - run: powershell ci\build.ps1 -NoTests
  143. env:
  144. CONFIGURATION: ${{ matrix.config }}
  145. - uses: actions/upload-artifact@v2
  146. with:
  147. name: ${{ matrix.archive }}
  148. path: build/${{ matrix.archive }}.zip
  149. retention-days: 1
  150. - uses: actions/upload-artifact@v2
  151. with:
  152. name: ${{ matrix.archive }}
  153. path: build/${{ matrix.archive }}.msi
  154. retention-days: 1
  155. publish:
  156. needs: [linux, appimage, macOS, windows]
  157. runs-on: ubuntu-20.04
  158. env:
  159. GH_REPO: ${{ github.repository }}
  160. permissions:
  161. contents: write
  162. steps:
  163. # Must perform checkout first, since it deletes the target directory
  164. # before running, and would therefore delete the downloaded artifacts
  165. - uses: actions/checkout@v2
  166. - uses: actions/download-artifact@v2
  167. - name: Install dependencies
  168. run: |
  169. sudo apt-get update
  170. sudo apt-get install -y gettext-base
  171. - if: github.event_name == 'workflow_dispatch'
  172. run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
  173. - if: github.event_name == 'schedule'
  174. run: echo 'TAG_NAME=nightly' >> $GITHUB_ENV
  175. - if: github.event_name == 'push'
  176. run: |
  177. TAG_NAME=${{ github.ref }}
  178. echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV
  179. - if: env.TAG_NAME == 'nightly'
  180. env:
  181. GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  182. run: |
  183. (echo 'SUBJECT=Nvim development (prerelease) build';
  184. echo 'PRERELEASE=--prerelease') >> $GITHUB_ENV
  185. gh release delete nightly --yes || true
  186. git push origin :nightly || true
  187. - if: env.TAG_NAME != 'nightly'
  188. env:
  189. GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  190. run: |
  191. (echo 'SUBJECT=Nvim release build';
  192. echo 'PRERELEASE=') >> $GITHUB_ENV
  193. gh release delete stable --yes || true
  194. git push origin :stable || true
  195. # `sha256sum` outputs <sha> <path>, so we cd into each dir to drop the
  196. # containing folder from the output.
  197. - name: Generate Linux64 SHA256 checksums
  198. run: |
  199. cd ./nvim-linux64
  200. sha256sum nvim-linux64.tar.gz > nvim-linux64.tar.gz.sha256sum
  201. echo "SHA_LINUX_64_TAR=$(cat nvim-linux64.tar.gz.sha256sum)" >> $GITHUB_ENV
  202. sha256sum nvim-linux64.deb > nvim-linux64.deb.sha256sum
  203. echo "SHA_LINUX_64_DEB=$(cat nvim-linux64.deb.sha256sum)" >> $GITHUB_ENV
  204. - name: Generate App Image SHA256 checksums
  205. run: |
  206. cd ./appimage
  207. sha256sum nvim.appimage > nvim.appimage.sha256sum
  208. echo "SHA_APP_IMAGE=$(cat nvim.appimage.sha256sum)" >> $GITHUB_ENV
  209. - name: Generate App Image Zsync SHA256 checksums
  210. run: |
  211. cd ./appimage
  212. sha256sum nvim.appimage.zsync > nvim.appimage.zsync.sha256sum
  213. echo "SHA_APP_IMAGE_ZSYNC=$(cat nvim.appimage.zsync.sha256sum)" >> $GITHUB_ENV
  214. - name: Generate macOS SHA256 checksums
  215. run: |
  216. cd ./nvim-macos
  217. sha256sum nvim-macos.tar.gz > nvim-macos.tar.gz.sha256sum
  218. echo "SHA_MACOS=$(cat nvim-macos.tar.gz.sha256sum)" >> $GITHUB_ENV
  219. - name: Generate Win64 SHA256 checksums
  220. run: |
  221. cd ./nvim-win64
  222. sha256sum nvim-win64.zip > nvim-win64.zip.sha256sum
  223. echo "SHA_WIN_64_ZIP=$(cat nvim-win64.zip.sha256sum)" >> $GITHUB_ENV
  224. sha256sum nvim-win64.msi > nvim-win64.msi.sha256sum
  225. echo "SHA_WIN_64_MSI=$(cat nvim-win64.msi.sha256sum)" >> $GITHUB_ENV
  226. - name: Publish release
  227. env:
  228. GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  229. NVIM_VERSION: ${{ needs.linux.outputs.version }}
  230. DEBUG: api
  231. run: |
  232. envsubst < "$GITHUB_WORKSPACE/.github/workflows/notes.md" > "$RUNNER_TEMP/notes.md"
  233. gh release create $TAG_NAME $PRERELEASE --notes-file "$RUNNER_TEMP/notes.md" --title "$SUBJECT" --target $GITHUB_SHA nvim-macos/* nvim-linux64/* appimage/* nvim-win64/*
  234. if [ "$TAG_NAME" != "nightly" ]; then
  235. gh release create stable $PRERELEASE --notes-file "$RUNNER_TEMP/notes.md" --title "$SUBJECT" --target $GITHUB_SHA nvim-macos/* nvim-linux64/* appimage/* nvim-win64/*
  236. fi