-
-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3b5ad19
Showing
67 changed files
with
11,695 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
**/*.md |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*.md linguist-vendored=false | ||
*.md linguist-generated=false | ||
*.md linguist-documentation=false | ||
*.md linguist-detectable=true |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# These are supported funding model platforms | ||
|
||
github: [LittleSound,nekomeowww] | ||
# patreon: # Replace with a single Patreon username | ||
# open_collective: # Replace with a single Open Collective username | ||
# ko_fi: # Replace with a single Ko-fi username | ||
# tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel | ||
# community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry | ||
# liberapay: # Replace with a single Liberapay username | ||
# issuehunt: # Replace with a single IssueHunt username | ||
# otechie: # Replace with a single Otechie username | ||
# lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry | ||
# custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] |
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 |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: 构建预览 | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
env: | ||
STORE_PATH: '' | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
name: 构建 | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
# This is quite weird. | ||
# Eventhough this is the *intended* solution introduces in official blog post here | ||
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/. | ||
# But still, as https://github.com/orgs/community/discussions/25220#discussioncomment-7856118 stated, | ||
# this is vulnerable since there is no source of truth about which PR in the triggered workflow. | ||
- name: 保留 PR 信息 | ||
run: | | ||
echo "${{ github.event.number }}" > pr_num | ||
- name: 上传 PR 信息 | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: pr-num | ||
path: ./pr_num | ||
|
||
- name: 签出代码 | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: 安装 Node.js 20.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20.x | ||
|
||
- name: 安装 pnpm | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
run_install: false | ||
version: 8 | ||
|
||
- name: 获取 pnpm store 目录 | ||
shell: bash | ||
run: | | ||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | ||
- name: 配置 pnpm 缓存 | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ env.STORE_PATH }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- name: 安装依赖 | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: 构建 | ||
run: | | ||
pnpm docs:build | ||
- name: 上传构建产物 | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: docs-build | ||
path: .vitepress/dist |
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 |
---|---|---|
@@ -0,0 +1,151 @@ | ||
name: 部署预览到 Netlify | ||
|
||
on: | ||
workflow_run: | ||
workflows: | ||
- 构建预览 | ||
types: | ||
- completed | ||
workflow_dispatch: | ||
|
||
env: | ||
PR_NUM: 0 | ||
STORE_PATH: '' | ||
NETLIFY_JSON_OUTPUT: '' | ||
NETLIFY_URL: '' | ||
|
||
jobs: | ||
on-success: | ||
name: 部署预览到 Netlify | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: 预览 Preview | ||
url: ${{ env.NETLIFY_URL }} | ||
permissions: | ||
pull-requests: write | ||
if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
steps: | ||
- name: 下载 PR 信息 | ||
uses: dawidd6/action-download-artifact@v3 | ||
with: | ||
workflow_conclusion: success | ||
run_id: ${{ github.event.workflow_run.id }} | ||
name: pr-num | ||
path: pr-num | ||
allow_forks: true | ||
|
||
- name: 获取 PR 信息 | ||
id: pr-num | ||
run: | | ||
echo "PR_NUM=$(cat pr-num/pr_num)" >> $GITHUB_ENV | ||
- name: 下载构建产物 | ||
uses: dawidd6/action-download-artifact@v3 | ||
with: | ||
workflow_conclusion: success | ||
run_id: ${{ github.event.workflow_run.id }} | ||
name: docs-build | ||
path: docs-build | ||
allow_forks: true | ||
|
||
- name: 安装 Node.js 20.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20.x | ||
|
||
- name: 安装 pnpm | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
run_install: false | ||
version: 8 | ||
|
||
- name: 获取 pnpm store 目录 | ||
shell: bash | ||
run: | | ||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | ||
- name: 配置 pnpm 缓存 | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ env.STORE_PATH }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- name: 安装 Netlify CLI | ||
run: pnpm install -g netlify-cli | ||
|
||
- name: 推送到 Netlify | ||
run: | | ||
NETLIFY_JSON_OUTPUT=$(netlify deploy --dir docs-build --json) | ||
echo $NETLIFY_JSON_OUTPUT | ||
echo "NETLIFY_JSON_OUTPUT=$(echo $NETLIFY_JSON_OUTPUT)" >> $GITHUB_ENV | ||
echo "NETLIFY_URL=$(echo $NETLIFY_JSON_OUTPUT | jq -r .deploy_url)" >> $GITHUB_ENV | ||
env: | ||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | ||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | ||
|
||
- name: 搜索评论 ID | ||
uses: peter-evans/find-comment@v2 | ||
id: fc | ||
with: | ||
issue-number: ${{ env.PR_NUM }} | ||
comment-author: 'github-actions[bot]' | ||
body-includes: 到 Netlify | ||
|
||
- name: 创建或更新评论 | ||
uses: peter-evans/create-or-update-comment@v3 | ||
with: | ||
comment-id: ${{ steps.fc.outputs.comment-id }} | ||
issue-number: ${{ env.PR_NUM }} | ||
body: | | ||
## ✅ 成功部署到 Netlify | ||
| 系统 | 状态 | 预览链接 | | ||
|:---------|:------------|:----------------------------------| | ||
| Ubuntu | 成功 | ${{ env.NETLIFY_URL }} | | ||
edit-mode: replace | ||
|
||
on-failure: | ||
name: 无法部署预览到 Netlify | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
|
||
if: ${{ github.event.workflow_run.conclusion == 'failure' }} | ||
steps: | ||
- name: 下载 PR 信息 | ||
uses: dawidd6/action-download-artifact@v3 | ||
with: | ||
workflow_conclusion: success | ||
run_id: ${{ github.event.workflow_run.id }} | ||
name: pr-num | ||
path: pr-num | ||
allow_forks: true | ||
|
||
- name: 获取 PR 信息 | ||
id: pr-num | ||
run: | | ||
echo "PR_NUM=$(cat pr-num/pr_num)" >> $GITHUB_ENV | ||
- name: 搜索评论 ID | ||
uses: peter-evans/find-comment@v2 | ||
id: fc | ||
with: | ||
issue-number: ${{ env.PR_NUM }} | ||
comment-author: 'github-actions[bot]' | ||
body-includes: 到 Netlify | ||
|
||
- name: 创建或更新评论 | ||
uses: peter-evans/create-or-update-comment@v3 | ||
with: | ||
comment-id: ${{ steps.fc.outputs.comment-id }} | ||
issue-number: ${{ env.PR_NUM }} | ||
body: | | ||
## ❌ 无法部署到 Netlify | ||
| 系统 | 状态 | 预览链接 | | ||
|:---------|:------------|:----------------------------------| | ||
| Ubuntu | 失败 | 请检查工作流程运行的状态和日志。 | | ||
edit-mode: replace |
67 changes: 67 additions & 0 deletions
67
.github/workflows/production-deployment-to-github-pages.yaml
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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: 构建并部署到 Github Pages | ||
|
||
on: | ||
workflow_dispatch: | ||
# push: | ||
# branches: | ||
# - 'main' | ||
|
||
|
||
env: | ||
STORE_PATH: '' | ||
|
||
concurrency: | ||
group: ${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
name: Ubuntu 构建和推送 | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: 正式 Production - GitHub Pages | ||
url: https://nolebase.github.io/nolebase | ||
steps: | ||
- name: 签出代码 | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: 安装 Node.js 20.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20.x | ||
|
||
- name: 安装 pnpm | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
run_install: false | ||
version: 8 | ||
|
||
- name: 获取 pnpm store 目录 | ||
shell: bash | ||
run: | | ||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | ||
- name: 配置 pnpm 缓存 | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ env.STORE_PATH }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- name: 安装依赖 | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: 构建 | ||
run: pnpm docs:build | ||
|
||
- name: 推送到 gh-pages 分支 | ||
timeout-minutes: 10 | ||
with: | ||
token: ${{ secrets.ACCESS_TOKEN }} | ||
BRANCH: gh-pages | ||
FOLDER: .vitepress/dist | ||
uses: JamesIves/github-pages-deploy-action@v4 | ||
|
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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: 构建并部署到 Netlify | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
workflow_dispatch: | ||
|
||
env: | ||
STORE_PATH: '' | ||
|
||
concurrency: | ||
group: ${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
name: Ubuntu 构建和推送 | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: 正式 Production | ||
url: https://nolebase.ayaka.io | ||
steps: | ||
- name: 签出代码 | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: 安装 Node.js 20.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20.x | ||
|
||
- name: 安装 pnpm | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
run_install: false | ||
version: 8 | ||
|
||
- name: 获取 pnpm store 目录 | ||
shell: bash | ||
run: | | ||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | ||
- name: 配置 pnpm 缓存 | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ env.STORE_PATH }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- name: 安装依赖 | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: 构建 | ||
run: pnpm docs:build | ||
|
||
- name: 安装 Netlify CLI | ||
run: pnpm install -g netlify-cli | ||
|
||
- name: 推送到 Netlify | ||
timeout-minutes: 10 | ||
run: netlify deploy --dir .vitepress/dist --prod | ||
env: | ||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | ||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | ||
|
Oops, something went wrong.