Skip to content

Commit 237608e

Browse files
committed
Merge branch 'main' of https://github.com/PKM-er/Pkmer-Math
2 parents 2a3da31 + 30a8b5a commit 237608e

File tree

1 file changed

+29
-20
lines changed

1 file changed

+29
-20
lines changed

.github/workflows/static.yml

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,13 @@ concurrency:
1717
jobs:
1818
deploy-gh-pages:
1919
runs-on: ubuntu-latest
20-
steps:
21-
# 获取仓库的相关配置
22-
# https://docs.github.com/zh/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#default-environment-variables
23-
# TODO:若 “仓库无前缀名” 是.github.io结尾,则设置为"/"
24-
- name: 配置 - 获取仓库配置
25-
id: config1 # 用于给其他仓库引用
26-
run: |
27-
echo "工作路径:${GITHUB_WORKSPACE}"
28-
echo "action路径:${GITHUB_ACTION_PATH}"
29-
echo "action仓库:${GITHUB_ACTION_REPOSITORY}"
30-
echo "仓库所有者(可以是组织):${GITHUB_REPOSITORY_OWNER}"
31-
echo "仓库作者:${GITHUB_ACTOR}"
32-
echo "仓库标识:${GITHUB_REPOSITORY}"
33-
echo "仓库url:${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}"
34-
REPO_NAME=$(echo "${GITHUB_REPOSITORY}" | cut -d'/' -f2)
35-
echo "::set-output name=REPO_NAME::$REPO_NAME"
36-
echo "仓库无前缀名:${REPO_NAME}"
37-
20+
steps:
3821
- name: 环境 - 构建库
3922
uses: actions/checkout@v4
4023
with:
4124
fetch-depth: 0
4225
repository: LincZero/LincZero.github.io
43-
ref: 'raw' # 分支
26+
ref: 'main' # 分支,旧raw
4427

4528
- name: 环境 - 安装 pnpm
4629
uses: pnpm/action-setup@v2
@@ -54,10 +37,36 @@ jobs:
5437
node-version: 20
5538
cache: pnpm
5639

40+
# 获取仓库的相关配置
41+
# https://docs.github.com/zh/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#default-environment-variables
42+
# TODO:若 “仓库无前缀名” 是.github.io结尾,则设置为"/"
43+
- name: 配置 - 获取仓库配置
44+
id: config1 # 用于给其他步骤引用
45+
working-directory: ./scripts/
46+
run: |
47+
> git_config.json # 先清空
48+
echo "{" >> git_config.json
49+
echo " \"GITHUB_WORKSPACE\": \"${GITHUB_WORKSPACE}\"," >> git_config.json # 工作路径
50+
echo " \"GITHUB_ACTION_PATH\": \"${GITHUB_ACTION_PATH}\"," >> git_config.json # action路径
51+
echo " \"GITHUB_ACTION_REPOSITORY\": \"${GITHUB_ACTION_REPOSITORY}\"," >> git_config.json # action仓库
52+
echo " \"GITHUB_REPOSITORY_OWNER\": \"${GITHUB_REPOSITORY_OWNER}\"," >> git_config.json # 仓库所属(格式: 可以是组织)
53+
echo " \"GITHUB_ACTOR\": \"${GITHUB_ACTOR}\"," >> git_config.json # 仓库作者(格式: 不会是组织)
54+
echo " \"GITHUB_REPOSITORY\": \"${GITHUB_REPOSITORY}\"," >> git_config.json # 仓库标识(格式: 个人或组织/仓库名)
55+
echo " \"CALC_URL\": \"${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/\"," >> git_config.json # 仓库url
56+
REPO_NAME=$(echo "${GITHUB_REPOSITORY}" | cut -d"/" -f2)
57+
echo " \"CALC_REPO_NAME\": \"${REPO_NAME}\"" >> git_config.json # 仓库无前缀名
58+
echo "}" >> git_config.json
59+
echo "::set-output name=REPO_NAME::$REPO_NAME"
60+
5761
# [!code] 根据实际情况修改
5862
- name: 配置 - 设置
63+
working-directory: ./
5964
run: |
60-
sed -i 's/base: \"\/\"/base: \"\/${{steps.config1.outputs.REPO_NAME}}\/\"/g' src/.vuepress/config.ts
65+
# sed -i 's/base: \"\/\"/base: \"\/${{steps.config1.outputs.REPO_NAME}}\/\"/g' ./src/.vuepress/config.ts
66+
cat ./scripts/git_config.json
67+
rm -f ./src/.vuepress/config_cover.js
68+
rm -f ./src/.vuepress/theme_cover.js
69+
pnpm run gen-config
6170
6271
# 文档的克隆、构建、部署。注意 `clone --depth 1` 只拉最近一次提交,减少时间
6372
- name: 文档 - 文档库克隆

0 commit comments

Comments
 (0)