-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (90 loc) · 4 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
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/*