-
Notifications
You must be signed in to change notification settings - Fork 0
127 lines (110 loc) · 5.01 KB
/
Copy pathrelease.yml
File metadata and controls
127 lines (110 loc) · 5.01 KB
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
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/*