Skip to content

Commit c6c7e25

Browse files
authored
Merge pull request #50 from mmdapl/feat/docs-update
feat: CI流程优化,修复部分脚本异常
2 parents 5b2bba0 + 85da235 commit c6c7e25

File tree

36 files changed

+5005
-2158
lines changed

36 files changed

+5005
-2158
lines changed

.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.

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,3 @@ docs/.vuepress/dist/
9595
.tern-port
9696
/docs/.vuepress/.temp/
9797
/.husky/
98-
/.husky/

.npmrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1+
## 锁定版本
2+
engine-strict = true
13
shamefully-hoist=true
24
registry=https://registry.npmmirror.com
3-
## 锁定node版本
4-
engine-strict = true

.versionrc.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// commit-and-tag-version 配置,参考:https://github.com/conventional-changelog/standard-version
2+
module.exports={
3+
"header": "# Release history\n\nAll notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n\n<!-- #region recent-beta -->\n",
4+
"releaseCommitMessageFormat": "chore(release): publish v{{currentTag}}",
5+
"types": [
6+
{ "type": "feat", "section": "Features" },
7+
{ "type": "feature", "section": "Features" },
8+
{ "type": "fix", "section": "Bug Fixes" },
9+
{ "type": "perf", "section": "Performance Improvements" },
10+
{ "type": "revert", "section": "Reverts" },
11+
{ "type": "docs", "section": "Documentation", "hidden": true },
12+
{ "type": "style", "section": "Styles", "hidden": true },
13+
{ "type": "chore", "section": "Miscellaneous Chores", "hidden": true },
14+
{ "type": "refactor", "section": "Code Refactoring", "hidden": true },
15+
{ "type": "test", "section": "Tests", "hidden": true },
16+
{ "type": "build", "section": "Build System", "hidden": true },
17+
{ "type": "ci", "section": "Continuous Integration", "hidden": true }
18+
],
19+
"skip": {
20+
"bump": true,
21+
"commit": true,
22+
"tag": true
23+
}
24+
}

Dockerfile

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
#
22
# - 功能: 构建JavaScriptCollection镜像
3-
# - 用法: docker build -f Dockerfile --build-arg APP_VERSION=0.0.1 -t JavaScriptCollection-0.0.1 .
3+
# - 用法: docker build -f Dockerfile --build-arg APP_VERSION=0.0.1 -build-arg CONTAINER_BUILD=true -t JavaScriptCollection-0.0.1 .
4+
# - 参数:
5+
# APP_VERSION: 版本
6+
# CONTAINER_BUILD: 采用容器构建
47
#
5-
## 注意:vite构建需要支持node14以上,安装node16较为稳妥
6-
FROM registry.cn-hangzhou.aliyuncs.com/142vip/node:16.12.0-alpine AS build_base
8+
# 注意:vite构建需要支持node14以上,安装node16较为稳妥
9+
FROM registry.cn-hangzhou.aliyuncs.com/142vip/node:16.20.2-alpine AS build_base
710

8-
RUN mkdir -p /apps
11+
ARG CONTAINER_BUILD
912
## 确定工作空间 /apps
1013
WORKDIR /apps
1114
COPY . .
1215

13-
## 安装依赖
14-
RUN npm i pnpm@6 -g && pnpm i -D && pnpm build
16+
RUN echo $CONTAINER_BUILD
17+
18+
## 基于容器自动构建
19+
RUN if [ "$CONTAINER_BUILD" = "true" ]; then \
20+
npm i pnpm@7 -g && pnpm i -D && pnpm build; \
21+
fi;
22+
1523

1624
FROM registry.cn-hangzhou.aliyuncs.com/142vip/nginx:1.23.0-alpine
1725
ARG APP_VERSION

Faster.Dockerfile

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

Readme.md

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
11
## JavaScriptCollection
22

33

4-
### 写最前面
5-
6-
7-
这里是工作、学习、生活中总结的各类笔记文章,涉及开发技术,也会感慨万千、水一些`思考`;若发现博客外链不能访问欢迎指正;
8-
所有内容会选择性的发表于**微信公众号、博客、掘金、CSDN、Github ,实际内容以本仓库排版、校对为主。** 代码会不定期同步到 **码云**
9-
10-
11-
**没有效访问链接的代表尚未完成,大家善用快捷键`Ctrl+F`**
12-
13-
14-
154
### 在线浏览
165

176
- 尝鲜版:<https://142vip.github.io/JavaScriptCollection>
@@ -24,9 +13,18 @@
2413
- Vercel: <https://js-collection.vercel.app>
2514

2615

27-
### 学习路线
16+
### 写在最前面
2817

2918

19+
这里是工作、学习、生活中总结的各类笔记文章,涉及开发技术,也会感慨万千、水一些`思考`;若发现博客外链不能访问欢迎指正;
20+
所有内容会选择性的发表于**微信公众号、博客、掘金、CSDN、Github ,实际内容以本仓库排版、校对为主。** 代码会不定期同步到 **码云**
21+
22+
23+
**没有效访问链接的代表尚未完成,大家善用快捷键`Ctrl+F`**
24+
25+
26+
27+
### 学习路线
3028

3129

3230
### 日常推荐
@@ -607,6 +605,17 @@ Nestjs框架推崇typescript语法,并且友好的兼容express框架,因此
607605

608606
**以下排名不分先后! 还木有收到赞助,哈哈哈,先留坑**
609607

608+
## 贡献
609+
610+
感谢向仓库提交mr的所有开发者
611+
612+
[![contributors](https://contrib.rocks/image?repo=142vip/JavaScriptCollection)](https://github.com/142vip/JavaScriptCollection/graphs/contributors)
613+
614+
## 趋势
615+
616+
<div style="text-align: center" align="center">
617+
<img alt="Star History" src="https://api.star-history.com/svg?repos=142vip/JavaScriptCollection&type=Date" >
618+
</div>
610619

611620

612621

0 commit comments

Comments
 (0)