release #3544
This file contains hidden or 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: '0 20 * * *' | |
| push: | |
| branches: [ main, test ] | |
| workflow_dispatch: | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Install neovim | |
| run: | | |
| mkdir ~/publish | |
| wget -qOnvim.tgz "https://github.com/neovim/neovim/releases/download/stable/nvim-linux-x86_64.tar.gz" | |
| tar xzf nvim.tgz | |
| sudo cp -rf ./nvim-linux-x86_64/* /usr/local | |
| nvim --version | |
| - uses: actions/checkout@v6 | |
| - 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/ | |
| echo "get tree-sitter====================" # {{{ | |
| cd /tmp | |
| wget -qOts.txz "https://github.com/fcying/tools/releases/download/tools/tree-sitter_linux_amd64.txz" | |
| tar xJvf ts.txz | |
| cp ./tree-sitter /usr/local/bin/ | |
| cd ~/.config | |
| echo "install plugins====================" | |
| nvim --headless "+Lazy! sync" +qa | |
| XZ_OPT=-9 tar cJf nvim_config.txz --exclude .git nvim | |
| mv ./*.txz ~/publish | |
| - name: Prepare nvim config with vendor | |
| run: | | |
| cp /usr/local/bin/tree-sitter ~/.config/nvim/vendor/ | |
| echo "mason install====================" # {{{ | |
| cd ~/.config | |
| # Clear the corrupted tree-sitter cache directories before installation | |
| rm -rf ./nvim/.run/cache | |
| nvim --headless -c 'MasonInstall --sync lua-language-server' -c qall | |
| nvim --headless -c 'MasonInstall --sync clangd' -c qall | |
| 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 -f ~/.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====================" # {{{ | |
| cd /tmp | |
| 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/ | |
| cp ./$filename/complete/_rg ~/.config/nvim/etc/fpath/ | |
| echo "get fd====================" # {{{ | |
| cd /tmp | |
| new_ver=$(curl -sv "https://github.com/sharkdp/fd/releases/latest" 2>&1 | grep -P location: | grep -Po "(\d+\.){2}\d+") | |
| filename=fd-v${new_ver}-x86_64-unknown-linux-musl | |
| wget -qOfd.tgz "https://github.com/sharkdp/fd/releases/download/v$new_ver/$filename.tar.gz" | |
| tar xzf fd.tgz | |
| chmod a+x ./$filename/fd | |
| mv ./$filename/fd ~/.config/nvim/vendor/ | |
| cp ./$filename/autocomplete/_fd ~/.config/nvim/etc/fpath/ | |
| echo "get universal-ctags====================" # {{{ | |
| cd /tmp | |
| wget -qO ctags.txz https://github.com/fcying/tools/releases/download/tools/ctags_linux_amd64.txz | |
| tar xJf ctags.txz | |
| mv ctags ~/.config/nvim/vendor/ | |
| echo "pack config====================" | |
| cd ~/.config | |
| # Remove runtime caches to prevent tar conflicts and reduce package size | |
| rm -rf ./nvim/.run/cache | |
| 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 "[fd](https://github.com/sharkdp/fd)" | |
| 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/* |