Release #293
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: | |
BIN_DIR: ${{ github.workspace }}/bin | |
MINIMUM_CMAKE_VERSION: '3.28' | |
# Build on the oldest supported images, so we have broader compatibility | |
# Build with gcc-10 to prevent triggering #14150 (default is still gcc-9 on 20.04) | |
jobs: | |
linux: | |
runs-on: ubuntu-20.04 | |
env: | |
CC: gcc-10 | |
outputs: | |
version: ${{ steps.build.outputs.version }} | |
container: | |
image: ubuntu:18.04 | |
options: --privileged # Privileged mode is needed to load fuse module. | |
steps: | |
- name: Prepare container | |
run: | | |
apt-get update | |
apt-get install -y software-properties-common | |
add-apt-repository -y ppa:ubuntu-toolchain-r/test # For gcc-10. | |
add-apt-repository -y ppa:git-core/ppa # For git>=2.18. | |
apt-get update | |
apt-get install -y git gcc-10 | |
apt-get install -y fuse libfuse2 # For linuxdeploy. | |
# 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 | |
- run: | | |
apt-get update | |
apt-get install -y build-essential curl gettext ninja-build unzip | |
- name: Add "$BIN_DIR" to path | |
run: echo "$BIN_DIR" >> $GITHUB_PATH | |
# TODO(dundargoc): this is very hacky. We only need to install cmake version | |
# that is at least the minimum cmake version, but for some reason the | |
# cmake releases didn't work as described. | |
- name: Install cmake | |
run: | | |
apt-get install -y cmake # Install cmake only for cpack, the cmake version itself is too old | |
curl --retry 5 --silent --show-error --fail -o /tmp/cmake-installer.sh "https://cmake.org/files/v${MINIMUM_CMAKE_VERSION}/cmake-${MINIMUM_CMAKE_VERSION}.0-linux-x86_64.sh" | |
mkdir -p "$BIN_DIR" /opt/cmake-custom | |
chmod a+x /tmp/cmake-installer.sh | |
/tmp/cmake-installer.sh --prefix=/opt/cmake-custom --skip-license | |
ln -sfn /opt/cmake-custom/bin/cmake "$BIN_DIR/cmake" | |
cmake_version="$(cmake --version | head -1)" | |
echo "$cmake_version" | grep -qF "cmake version $MINIMUM_CMAKE_VERSION.0" || { | |
echo "Unexpected CMake version: $cmake_version" | |
exit 1 | |
} | |
- 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 | |
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 | |
- if: env.TAG_NAME == 'nightly' | |
run: | | |
(echo 'SUBJECT=Nvim development (prerelease) build'; | |
echo 'PRERELEASE=--prerelease') >> $GITHUB_ENV | |
gh release delete nightly --yes || true | |
git push origin :nightly || true | |
- if: env.TAG_NAME != 'nightly' | |
run: | | |
(echo 'SUBJECT=Nvim release build'; | |
echo 'PRERELEASE=') >> $GITHUB_ENV | |
gh release delete stable --yes || true | |
git push origin :stable || true | |
- name: Publish release | |
env: | |
NVIM_VERSION: ${{ needs.linux.outputs.version }} | |
DEBUG: api | |
run: | | |
envsubst < "$GITHUB_WORKSPACE/.github/workflows/notes.md" > "$RUNNER_TEMP/notes.md" | |
if [ "$TAG_NAME" != "nightly" ]; then | |
gh release create stable $PRERELEASE --notes-file "$RUNNER_TEMP/notes.md" --title "$SUBJECT" --target $GITHUB_SHA nvim-linux64/* appimage/* | |
fi | |
gh release create $TAG_NAME $PRERELEASE --notes-file "$RUNNER_TEMP/notes.md" --title "$SUBJECT" --target $GITHUB_SHA nvim-linux64/* appimage/* |