-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: conditionally sync static files to server based on FTP key presence
- Loading branch information
1 parent
f41c12b
commit de0fea8
Showing
1 changed file
with
7 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,13 +9,15 @@ on: | |
jobs: | ||
LearnData-build: | ||
runs-on: ubuntu-latest | ||
env: | ||
FTP_HOST: ${{ secrets.ftp_host }} | ||
steps: | ||
- name: Checkout 🛎️ | ||
uses: actions/checkout@v4 | ||
with: | ||
# 获取所有标记和分支的所有历史记录(updatetime 必须,否则每次都会变化) | ||
fetch-depth: 0 | ||
# 如果你文档需要 Git 子模块,取消注释下一行 | ||
# 如果文档包含 Git 子模块,请取消注释下一行 | ||
# submodules: true | ||
|
||
- name: Install pnpm | ||
|
@@ -29,7 +31,7 @@ jobs: | |
node-version: 20 | ||
cache: pnpm | ||
|
||
# 将读书笔记复制到静态页路径,然后构建页面 | ||
# 复制读书笔记到静态页面路径,并构建页面 | ||
- name: Build Docs | ||
env: | ||
NODE_OPTIONS: --max_old_space_size=8192 | ||
|
@@ -41,13 +43,13 @@ jobs: | |
- name: Deploy GitHub Pages | ||
uses: JamesIves/github-pages-deploy-action@v4 | ||
with: | ||
# 这是文档部署到的分支名称 | ||
# 指定静态文件部署到的分支 | ||
branch: gh-pages | ||
folder: docs/.vuepress/dist | ||
|
||
### 没有服务器的话,请删除本区块代码,防止报错 ### | ||
# 将页面推送到服务器,timeout 时间从默认的 1 分钟调整到 10 分钟。 | ||
# 如果配置了 FTP 服务器密钥,才会执行本步骤,将页面静态文件同步到服务器 | ||
- name: 📂 Sync files | ||
if: env.FTP_HOST != '' | ||
uses: SamKirkland/[email protected] | ||
with: | ||
local-dir: docs/.vuepress/dist/ | ||
|
@@ -56,4 +58,3 @@ jobs: | |
password: ${{ secrets.ftp_password }} | ||
port: ${{ secrets.ftp_port }} # 建议更改默认的 21 端口 | ||
timeout: 600000 | ||
### 没有服务器的话,请删除本区块代码,防止报错 ### |