Release #457
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
schedule: | |
- cron: '5 5 * * *' | |
workflow_dispatch: | |
inputs: | |
tag_name: | |
description: 'Tag name for release' | |
required: false | |
default: nightly | |
push: | |
tags: | |
- v[0-9]+.[0-9]+.[0-9]+ | |
env: | |
ZIG_VERSION: 0.13.0 | |
GLIBC_VERSION: 2.17 | |
BIN_DIR: ${{ github.workspace }}/bin | |
# Build with zig cc so we can target glibc 2.17, so we have broader compatibility | |
jobs: | |
linux: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.build.outputs.version }} | |
steps: | |
- name: Install deps from apt | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y fuse libfuse2 # For linuxdeploy. | |
sudo apt-get install -y build-essential curl gettext ninja-build unzip cmake | |
sudo apt-get install -y xz-utils # To extract zig | |
# Workaround for https://github.com/actions/checkout/issues/766. | |
git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
- if: github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name != 'nightly' | |
uses: actions/checkout@v3 | |
with: | |
repository: 'neovim/neovim' | |
ref: ${{ github.event.inputs.tag_name }} | |
fetch-depth: 0 | |
- if: github.event_name == 'schedule' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name == 'nightly') | |
uses: actions/checkout@v3 | |
with: | |
repository: 'neovim/neovim' | |
fetch-depth: 0 | |
# zig cc with -02 implicitly adds -DNDEBUG so remove this from the generator flags | |
# Not needed for 0.10.1+ : https://github.com/neovim/neovim/pull/29599 | |
- name: Patch Neovim | |
run: sed -i '/APPEND gen_cflags -O2/d' src/nvim/CMakeLists.txt || true | |
- name: Add "$BIN_DIR" to path | |
run: | | |
mkdir -p "$BIN_DIR" | |
echo "$BIN_DIR" >> $GITHUB_PATH | |
- name: Install Zig | |
run: | | |
curl -O https://ziglang.org/download/$ZIG_VERSION/zig-linux-$(arch)-$ZIG_VERSION.tar.xz | |
tar -xf zig-linux-$(arch)-$ZIG_VERSION.tar.xz | |
rm -rf zig-linux-$(arch)-$ZIG_VERSION.tar.xz | |
ln -s $(pwd)/zig-linux-$(arch)-$ZIG_VERSION/zig $BIN_DIR/zig | |
# Include -lunwind so luajit can be linked | |
# Include -g0 to strip debug info by default. | |
# Note: Cmake should override this for debug builds by appending -g | |
echo 'exec zig cc -target $(arch)-linux-gnu.${GLIBC_VERSION} -lunwind -g0 "$@"' > $BIN_DIR/zigcc | |
chmod +x $BIN_DIR/zigcc | |
- if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name != 'nightly') | |
run: | | |
echo 'CMAKE_BUILD_TYPE=Release' >> $GITHUB_ENV | |
echo 'APPIMAGE_TAG=latest' >> $GITHUB_ENV | |
- if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name == 'nightly') | |
run: | | |
echo 'CMAKE_BUILD_TYPE=RelWithDebInfo' >> $GITHUB_ENV | |
echo 'APPIMAGE_TAG=nightly' >> $GITHUB_ENV | |
- name: appimage | |
env: | |
CC: zigcc | |
run: ./scripts/genappimage.sh ${APPIMAGE_TAG} | |
- run: cpack --config build/CPackConfig.cmake | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: appimage | |
path: | | |
build/bin/nvim.appimage | |
build/bin/nvim.appimage.zsync | |
retention-days: 1 | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: nvim-linux64 | |
path: | | |
build/nvim-linux64.tar.gz | |
build/nvim-linux64.deb | |
retention-days: 1 | |
- name: Export version | |
id: build | |
run: | | |
printf 'version<<END\n' >> $GITHUB_OUTPUT | |
./build/bin/nvim --version | head -n 3 >> $GITHUB_OUTPUT | |
printf 'END\n' >> $GITHUB_OUTPUT | |
publish: | |
needs: [linux] | |
runs-on: ubuntu-latest | |
env: | |
GH_REPO: ${{ github.repository }} | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
permissions: | |
contents: write | |
steps: | |
# Must perform checkout first, since it deletes the target directory | |
# before running, and would therefore delete the downloaded artifacts | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v3 | |
- name: Install dependencies | |
run: sudo apt-get update && sudo apt-get install -y gettext-base | |
- if: github.event_name == 'workflow_dispatch' | |
run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV | |
- if: github.event_name == 'schedule' | |
run: echo 'TAG_NAME=nightly' >> $GITHUB_ENV | |
- if: github.event_name == 'push' | |
run: | | |
TAG_NAME=${{ github.ref }} | |
echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV | |
- name: Publish release | |
env: | |
NVIM_VERSION: ${{ needs.linux.outputs.version }} | |
DEBUG: api | |
run: | | |
if [ "$TAG_NAME" == "nightly" ]; then | |
SUBJECT='Nvim development (prerelease) build' | |
PRERELEASE='--prerelease' | |
else | |
SUBJECT='Nvim release build' | |
PRERELEASE= | |
fi | |
envsubst < "$GITHUB_WORKSPACE/.github/workflows/notes.md" > "$RUNNER_TEMP/notes.md" | |
if [ "$TAG_NAME" == "nightly" ]; then | |
git push origin :nightly || true | |
else | |
gh release delete stable --yes || true | |
git push origin :stable || true | |
gh release create stable \ | |
--notes-file "$RUNNER_TEMP/notes.md" \ | |
--title "$SUBJECT" \ | |
--target $GITHUB_SHA \ | |
nvim-linux64/* appimage/* | |
fi | |
gh release delete $TAG_NAME --yes || true | |
gh release create $TAG_NAME $PRERELEASE \ | |
--notes-file "$RUNNER_TEMP/notes.md" \ | |
--title "$SUBJECT" \ | |
--target $GITHUB_SHA \ | |
nvim-linux64/* appimage/* |