File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
content/posts/deploy twikoo on netlify Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 13
13
14
14
> 在本篇文章里,我会介绍如何在Netlify上部署Twikoo评论系统,如何接入到静态博客Hugo,以及如何实现Twikoo系统版本自动更新。
15
15
16
+ * 2024年7月30日更新:因为[ Github接口策略调整] ( https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting ) ,原有的匿名通过接口获取版本号方法失效,已更改为带token方式请求接口获取版本号,详见workflow里Get twikoo version步骤配置。*
17
+
16
18
#### 背景
17
19
18
20
博客之前通过` Vercel ` 部署了` Twikoo ` 评论系统,但是最近发现加载很慢。
@@ -145,10 +147,14 @@ jobs:
145
147
146
148
# Runs a single command using the runners shell
147
149
- name: update version
150
+ env:
151
+ github_token: ${{ secrets.TOKEN }}
148
152
run: |
149
- response=$(curl -s https://api.github.com/repos/twikoojs/twikoo/releases/latest)
153
+ response=$(curl -sf -H "Authorization: token $github_token" -H "Accept: application/vnd.github+json" https://api.github.com/repos/twikoojs/twikoo/releases/latest)
150
154
version=$(echo $response | jq -r '.tag_name')
151
- sed -i "s/\"twikoo-netlify\": \".*\"/\"twikoo-netlify\": \"$version\"/" package.json
155
+ if [ -n "$version" ]; then
156
+ sed -i "s/\"twikoo-netlify\": \".*\"/\"twikoo-netlify\": \"$version\"/" package.json
157
+ fi
152
158
shell: bash
153
159
154
160
# Runs a set of commands using the runners shell
@@ -227,4 +233,4 @@ params:
227
233
228
234
需要将` https://raw.githubusercontent.com/Liudon/twikoo-netlify/main/package.json ` 这个url里的` Liudon/twikoo-netlify ` 改为你的仓库名。
229
235
230
- 这下后面` Twikoo ` 官方更新版本,博客的` Twikoo ` 也会跟着自动更新。
236
+ 这下后面` Twikoo ` 官方更新版本,博客的` Twikoo ` 也会跟着自动更新。
You can’t perform that action at this time.
0 commit comments