Skip to content

add snacks.nvim

add snacks.nvim #2662

Workflow file for this run

name: release
on:
schedule:
- cron: '0 20 * * *'
push:
branches: [ master, test ]
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
release:
runs-on: ubuntu-20.04
steps:
- name: Install neovim
run: |
mkdir ~/publish
wget -qOnvim.tgz "https://github.com/neovim/neovim/releases/download/stable/nvim-linux64.tar.gz"
tar xzf nvim.tgz
sudo cp -rf ./nvim-linux64/* /usr/local
nvim --version
- uses: actions/checkout@v4
- name: Prepare nvim config
run: |
pwd && ls
mkdir -p ~/.config/nvim
# init default nvim config
cp -r init.lua lua/ dict/ ~/.config/nvim
cp -r snippets/ vendor/ etc/ ~/.config/nvim/
cd ~/.config
echo "install plugins===================="
# set treesitter ensure_install sync install
# sed 's|sync_install = false|sync_install = true|' -i ~/.config/nvim/lua/plugins/treesitter.lua
nvim --headless "+Lazy! sync" +qa
# sed 's|sync_install = true|sync_install = false|' -i ~/.config/nvim/lua/plugins/treesitter.lua
XZ_OPT=-9 tar cJf nvim_config.txz --exclude .git nvim
mv ./*.txz ~/publish
- name: Prepare nvim config with vendor
run: |
cd ~/.config
echo "install vendor===================="
nvim --headless -c 'MasonInstall --sync lua-language-server' -c 'q'
nvim --headless -c 'MasonInstall --sync clangd' -c 'q'
echo "update mason script===================="
# replace link to file
sed 's|/home/runner|~|' -i ~/.config/nvim/.run/mason/share/mason-schemas/lsp/clangd.json
sed 's|/home/runner|~|' -i ~/.config/nvim/.run/mason/share/mason-schemas/lsp/lua-language-server.json
rm ~/.config/nvim/.run/mason/bin/*
{
echo "#!/usr/bin/env bash"
echo 'cd "$(dirname $(readlink -f $0))"'
echo 'exec "../packages/clangd/clangd/bin/clangd" "$@"'
} | tee ~/.config/nvim/.run/mason/bin/clangd
{
echo "#!/usr/bin/env bash"
echo 'cd "$(dirname $(readlink -f $0))"'
echo 'exec "../packages/lua-language-server/libexec/bin/lua-language-server" "$@"'
} | tee ~/.config/nvim/.run/mason/bin/lua-language-server
chmod +x ~/.config/nvim/.run/mason/bin/*
echo "get rg===================="
new_ver=$(curl -sv "https://github.com/BurntSushi/ripgrep/releases/latest" 2>&1 | grep -P location: | grep -Po "(\d+\.){2}\d+")
filename=ripgrep-${new_ver}-x86_64-unknown-linux-musl
wget -qOrg.tgz "https://github.com/BurntSushi/ripgrep/releases/download/$new_ver/$filename.tar.gz"
tar xzf rg.tgz
chmod a+x ./$filename/rg
mv ./$filename/rg ~/.config/nvim/vendor/
rm -r rg.tgz $filename
echo "get universal-ctags===================="
wget -qO ctags.txz https://github.com/fcying/tools/releases/download/tools/ctags_linux_amd64.txz
tar xJf ctags.txz
rm ctags.txz
mv ctags ~/.config/nvim/vendor/
XZ_OPT=-9 tar cJf nvim_config_with_vendor.txz --exclude .git nvim
mv ./*.txz ~/publish
- name: Publish release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
{
echo "nvim_config work with [NeoVim](https://github.com/neovim/neovim/releases/latest)"
echo -e "\n"
echo "### vendor:"
echo "[ripgrep](https://github.com/BurntSushi/ripgrep)"
echo "[universal-ctags](https://github.com/universal-ctags/ctags)"
echo "[clangd](https://github.com/clangd/clangd)"
echo "[sumneko_lua](https://github.com/sumneko/lua-language-server)"
} | tee /tmp/note.md
gh release delete nvim_config -y || true
git push origin :nvim_config || true
gh release create nvim_config -t "nvim_config" -F "/tmp/note.md" --target $GITHUB_SHA ~/publish/*