Skip to content

Commit d07cfd7

Browse files
authored
Merge pull request #51 from mmdapl/next
feat: 修复一些功能异常
2 parents 58f0c32 + 4147f80 commit d07cfd7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+5369
-2447
lines changed

.DS_Store

-10 KB
Binary file not shown.

.github/workflows/CD.yaml

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
## CD交付流水线
2+
## - 部署到Github Pages
3+
## - 部署到Vercel托管平台
4+
## - 发布新的Github Release
5+
## 参考资料:https://v2.vuepress.vuejs.org/zh/guide/deployment.html#github-pages
6+
7+
name: CD
8+
on:
9+
push:
10+
branches:
11+
- master
12+
- next
13+
workflow_dispatch:
14+
15+
16+
## vercel 环境变量
17+
env:
18+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
19+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
20+
21+
jobs:
22+
install-init:
23+
name: "流水线初始化"
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- name: Checkout Code
28+
uses: actions/checkout@v3
29+
with:
30+
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录
31+
fetch-depth: 0
32+
33+
- name: Install Node.js
34+
uses: actions/setup-node@v3
35+
with:
36+
node-version: 16.20.2
37+
38+
- name: PNPM Install
39+
uses: pnpm/action-setup@v2
40+
with:
41+
version: 7
42+
run_install: true
43+
44+
- name: Cache Dependencies
45+
uses: actions/cache@v3
46+
with:
47+
path: |
48+
node_modules
49+
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/pnpm-lock.yaml') }}
50+
51+
## 部署到Github-Pages
52+
deploy-github:
53+
name: "部署到Github-Pages"
54+
needs: install-init
55+
runs-on: ubuntu-latest
56+
57+
steps:
58+
- name: Checkout Code
59+
uses: actions/checkout@v3
60+
with:
61+
fetch-depth: 0
62+
63+
- name: Restore Dependencies From cache
64+
uses: actions/cache@v3
65+
with:
66+
path: |
67+
node_modules
68+
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/pnpm-lock.yaml') }}
69+
70+
71+
# 运行构建脚本
72+
- name: Build VuePress Site
73+
run: ./scripts/bundle build_proxy
74+
75+
- name: Deploy To GitHub Page
76+
uses: crazy-max/ghaction-github-pages@v3
77+
with:
78+
target_branch: pages/github
79+
build_dir: docs/.vuepress/dist
80+
env:
81+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82+
83+
## 部署到vercel平台
84+
# deploy-vercel:
85+
# name: "部署到Vercel平台"
86+
# needs: install-init
87+
# runs-on: ubuntu-latest
88+
# if: github.repository == '142vip/JavaScriptCollection'
89+
# steps:
90+
# - name: Checkout Code
91+
# uses: actions/checkout@v3
92+
# with:
93+
# fetch-depth: 0
94+
#
95+
# - name: Restore Dependencies From Cache
96+
# uses: actions/cache@v3
97+
# with:
98+
# path: |
99+
# node_modules
100+
# key: ${{ runner.os }}-node_modules-${{ hashFiles('**/pnpm-lock.yaml') }}
101+
#
102+
# - name: Pull Vercel Environment Information
103+
# run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
104+
#
105+
# ## 注意:安装pnpm
106+
# - name: Build Project Artifacts
107+
# run: npm i pnpm@7 -g && vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
108+
#
109+
# - name: Deploy Project Artifacts to Vercel
110+
# run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
111+
112+
## 版本发布
113+
release:
114+
name: "创建Github发布"
115+
runs-on: ubuntu-latest
116+
needs: install-init
117+
## 主库master、next且执行release更新时执行
118+
if: github.repository == '142vip/JavaScriptCollection' && startsWith(github.event.head_commit.message, 'chore(release):')
119+
120+
steps:
121+
- name: Restore Dependencies From cache
122+
uses: actions/cache@v3
123+
with:
124+
path: |
125+
~/.pnpm-store
126+
node_modules
127+
key: ${{ runner.os }}-cache-${{ hashFiles('**/pnpm-lock.yaml') }}
128+
restore-keys: |
129+
${{ runner.os }}-cache-
130+
131+
### 打成压缩包
132+
- name: Create Zip Package
133+
run: |
134+
zip -r JavaScriptCollection.zip . \
135+
-x "node_modules/*"
136+
137+
# 提取版本号
138+
- name: Get New Version Number
139+
id: extract_version
140+
run: echo "::set-output name=version::$(node -p "require('./package.json').version")"
141+
142+
# 创建发布版本
143+
- name: Create New Release
144+
id: create_release
145+
uses: actions/create-release@latest
146+
env:
147+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
148+
with:
149+
tag_name: v${{ steps.extract_version.outputs.version }}
150+
release_name: v${{ steps.extract_version.outputs.version }}
151+
body: |
152+
Release ${{ steps.extract_version.outputs.version }}
153+
154+
### Features
155+
156+
### Bug Fixes
157+
158+
## 更新资源
159+
- name: Upload Resource Assets
160+
uses: actions/upload-release-asset@latest
161+
env:
162+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
163+
with:
164+
upload_url: ${{ steps.create_release.outputs.upload_url }}
165+
asset_path: ./JavaScriptCollection.zip
166+
asset_name: JavaScriptCollection.zip
167+
asset_content_type: application/zip

.github/workflows/CI.yaml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
## 代码CI快速集成流水线,lint、fix、build
2+
3+
4+
name: CI
5+
## 触发条件
6+
on:
7+
pull_request:
8+
branches:
9+
- 'master'
10+
- 'next'
11+
- '!pages/**'
12+
push:
13+
branches:
14+
- master
15+
- next
16+
# 手动触发部署
17+
workflow_dispatch:
18+
19+
schedule:
20+
- cron: "0 0 1 * *"
21+
22+
jobs:
23+
install-init:
24+
name: "流水线初始化"
25+
runs-on: ubuntu-latest
26+
permissions:
27+
actions: read
28+
pull-requests: read
29+
30+
steps:
31+
- name: checkout code
32+
uses: actions/checkout@v3
33+
with:
34+
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录
35+
fetch-depth: 0
36+
37+
- name: Install Node.js
38+
uses: actions/setup-node@v3
39+
with:
40+
node-version: 16.20.2
41+
42+
- name: PNPM Install
43+
uses: pnpm/action-setup@v2
44+
with:
45+
version: 7
46+
run_install: true
47+
48+
- name: Cache Dependencies
49+
uses: actions/cache@v3
50+
with:
51+
path: node_modules
52+
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/pnpm-lock.yaml') }}
53+
Base-Build:
54+
name: "基础编译构建"
55+
runs-on: ubuntu-latest
56+
needs: install-init
57+
steps:
58+
- name: Checkout Code
59+
uses: actions/checkout@v3
60+
with:
61+
fetch-depth: 0
62+
63+
- name: Restore Dependencies From Cache
64+
uses: actions/cache@v3
65+
with:
66+
path: node_modules
67+
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/pnpm-lock.yaml') }}
68+
69+
- name: Code LintFix
70+
run: ./scripts/lint --fix
71+
72+
- name: Build Site
73+
run: ./scripts/bundle build
74+
75+
- name: Build Site With Proxy
76+
run: ./scripts/bundle build_proxy
77+
78+
Build-Docker-Image:
79+
name: "构建Docker镜像"
80+
runs-on: ubuntu-latest
81+
needs: install-init
82+
## 主库master、next且执行release更新时执行
83+
if: github.repository == '142vip/408CSFamily' && startsWith(github.event.head_commit.message, 'chore(release):')
84+
permissions:
85+
actions: read
86+
pull-requests: read
87+
88+
steps:
89+
- name: Checkout Code
90+
uses: actions/checkout@v3
91+
with:
92+
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录
93+
fetch-depth: 0
94+
95+
- name: Login Docker
96+
run: |
97+
docker version
98+
echo "-----------Docker Login-----------"
99+
docker login \
100+
--username=${{ env.UserName }} \
101+
--password=${{ secrets.DOCKER_PASSWORD }} \
102+
${{env.REGISTRY}}
103+
104+
- name: Restore Dependencies From Cache
105+
uses: actions/cache@v3
106+
with:
107+
path: node_modules
108+
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/pnpm-lock.yaml') }}
109+
110+
111+
## 构建,支持domain
112+
- name: Build To Dist
113+
run: ./scripts/bundle build_proxy
114+
115+
- name: Push Docker Image
116+
run: ./scripts/bundle image_faster

.github/workflows/code-ci.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.github/workflows/docker-image.yml

Lines changed: 0 additions & 55 deletions
This file was deleted.

0 commit comments

Comments
 (0)