-
Notifications
You must be signed in to change notification settings - Fork 2
156 lines (154 loc) · 5.13 KB
/
plugin_ci.yml
File metadata and controls
156 lines (154 loc) · 5.13 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: Neovim Plugin CI/CD
on:
workflow_call:
secrets:
RELEASE_TOKEN:
description: "GitHub PAT for creating the release PRs so that they trigger GitHub Actions"
required: false
inputs:
plugin_name:
description: "Name of the neovim plugin"
required: true
type: string
is_production:
description: "Whether or not to perform production tasks"
default: false
required: false
type: boolean
docs:
description: "Whether or not to build and deploy"
default: true
required: false
type: boolean
spellcheck:
description: "Whether or not to check spelling"
default: true
required: false
type: boolean
commit_msg:
description: "Whether or not to validate conventional commit messages"
default: true
required: false
type: boolean
jobs:
typos:
name: Spell Check
runs-on: ubuntu-latest
if: ${{ inputs.spellcheck && !inputs.is_production }}
steps:
- uses: actions/checkout@v6
- uses: crate-ci/typos@master
commit_msg:
name: Conventional Commit Messages
runs-on: ubuntu-latest
if: ${{ inputs.commit_msg && !inputs.is_production }}
steps:
- uses: actions/checkout@v6
- uses: webiny/action-conventional-commits@v1.4.2
style:
name: Stylua Formatting
runs-on: ubuntu-latest
if: ${{ inputs.plugin_name != '' }}
steps:
- uses: actions/checkout@v6
- uses: JohnnyMorganz/stylua-action@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest
args: --check lua
lint:
name: Selene Linting
runs-on: ubuntu-latest
if: ${{ inputs.plugin_name != '' }}
steps:
- uses: actions/checkout@v6
- uses: NTBBloodbath/selene-action@v1.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --display-style=quiet lua
vimdoc:
name: Generate Vimdoc
runs-on: ubuntu-latest
needs:
- style
- lint
if: ${{ inputs.plugin_name != '' && inputs.docs }}
steps:
- uses: actions/checkout@v6
with:
token: ${{ secrets.RELEASE_TOKEN != null && secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN }}
- name: Install Lua Language Server
uses: jdx/mise-action@v4
with:
version: 2025.3.7
tool_versions: |
lua-language-server latest
- name: Build API docs and prepare Panvimdoc
env:
PLUGIN_NAME: ${{ inputs.plugin_name }}
run: |
mkdir -p doc
if [ ! -e "doc/${PLUGIN_NAME}.txt" ]; then
touch "doc/${PLUGIN_NAME}.txt"
fi
lua-language-server --doc . --doc_out_path api --logpath api
sed -i -n "/^# ${PLUGIN_NAME}\(\..*\)\{0,1\}$/,/^-\+$/p" api/doc.md
if [ -s "api/doc.md" ]; then
sed -i '/^-\+$/d ; s/^#/##/g ; s/^@//g' api/doc.md
echo "# Lua API" >doc/api.md
echo "" >>doc/api.md
echo "${PLUGIN_NAME} API documentation" >>doc/api.md
echo "" >>doc/api.md
cat api/doc.md >>doc/api.md
echo "" >>README.md
cat doc/api.md >>README.md
fi
rm -rf api
- name: panvimdoc
uses: kdheepak/panvimdoc@main
with:
vimdoc: ${{ inputs.plugin_name }}
version: "Neovim >= 0.9.0"
demojify: true
treesitter: true
- name: Push changes
if: ${{ inputs.is_production }}
uses: stefanzweifel/git-auto-commit-action@v7
with:
file_pattern: "doc/*"
commit_message: "chore(build): auto-generate vimdoc"
commit_user_name: "astronvimbot"
commit_user_email: "github@astronvim.com"
commit_author: "AstroNvim Bot <github@astronvim.com>"
release:
name: Release Please
runs-on: ubuntu-latest
if: ${{ inputs.is_production }}
steps:
- uses: googleapis/release-please-action@v5
id: release
with:
token: ${{ secrets.RELEASE_TOKEN }}
release-type: simple
- uses: actions/checkout@v6
- uses: rickstaa/action-create-tag@v1
if: ${{ steps.release.outputs.release_created }}
with:
tag: stable
message: "Current stable release: ${{ steps.release.outputs.tag_name }}"
tag_exists_error: false
force_push_tag: true
- uses: rickstaa/action-create-tag@v1
if: ${{ steps.release.outputs.release_created }}
with:
tag: "v${{ steps.release.outputs.major }}"
message: "Current v${{ steps.release.outputs.major }} release: ${{ steps.release.outputs.tag_name }}"
tag_exists_error: false
force_push_tag: true
- uses: rickstaa/action-create-tag@v1
if: ${{ steps.release.outputs.release_created }}
with:
tag: "v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}"
message: "Current v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} release: ${{ steps.release.outputs.tag_name }}"
tag_exists_error: false
force_push_tag: true