Browse Source

merge master

master
jiannibang 4 years ago
parent
commit
b91d0a3986
  1. 15
      .drone.yml
  2. 31
      .githooks/commit-msg
  3. 6
      .githooks/pre-commit
  4. 0
      .githooks/pre-push
  5. 54
      .gitignore
  6. 24
      .releaserc
  7. 3
      Dockerfile
  8. 29
      README.md

15
.drone.yml

@ -0,0 +1,15 @@
kind: pipeline
type: kubernetes
name: default
clone:
pull: if-not-exists
steps:
- name: test
image: golang:1.16.8-buster
# trigger:
# branch:
# - test
# event:
# - push

31
.githooks/commit-msg

@ -0,0 +1,31 @@
#!/bin/sh
# 用 `` 可以将命令的输出结果赋值给变量
# 获取当前提交的 commit msg
commit_msg=`cat $1`
# 获取用户 email
email=`git config user.email`
msg_re="^(feat|fix|docs|style|refactor|perf|test|workflow|build|ci|chore|release|workflow)(\(.+\))?: .{1,100}"
if [[ ! $commit_msg =~ $msg_re ]]
then
echo "\n不合法的 commit 消息提交格式,请使用正确的格式:\
\nfeat: add comments\
\nfix: handle events on blur (close #28)\
\n详情请查看 git commit 提交规范:https://github.com/woai3c/Front-end-articles/blob/master/git%20commit%20style.md"
# 异常退出
exit 1
fi
# 对用户权限做判断则比较简单,只需要检查用户的邮箱或用户名就可以了
#(假设现在只有 abc 公司的员工才有权限提交代码)。
email_re="@abc\.com"
if [[ ! $email =~ $email_re ]]
then
echo "此用户没有权限,具有权限的用户为: xxx@abc.com"
# 异常退出
exit 1
fi

6
.githooks/pre-commit

@ -0,0 +1,6 @@
#!/bin/sh
npm run lint
# 获取上面脚本的退出码
exitCode="$?"
exit $exitCode

0
.githooks/pre-push

54
.gitignore

@ -21,3 +21,57 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# ---> C
# Prerequisites
*.d
# Object files
*.o
*.ko
*.obj
*.elf
# Linker output
*.ilk
*.map
*.exp
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Debug files
*.dSYM/
*.su
*.idb
*.pdb
# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf

24
.releaserc

@ -0,0 +1,24 @@
{
"branches": ["master", "test"],
"plugins": [
["@semantic-release/commit-analyzer", {
"preset": "angular",
"releaseRules": [
{"type": "docs", "scope":"README", "release": "patch"},
{"type": "refactor", "release": "patch"},
{"type": "style", "release": "patch"}
],
"parserOpts": {
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES"]
}
}],
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/git",
["@saithodev/semantic-release-gitea", {
"giteaUrl": "https://git.1000my.com",
{"path": ".", "label": "源文件代码"}
}],
],
"tagFormat": "${process.env.GOOS}_v${version}"
}

3
Dockerfile

@ -0,0 +1,3 @@
FROM mcr.microsoft.com/dotnet/aspnet:3.1 AS base
#拷贝项目publish文件夹中的所有文件到 docker容器中的publish文件夹中
# COPY . /publish

29
README.md

@ -66,3 +66,32 @@ This section has moved here: https://facebook.github.io/create-react-app/docs/de
### `yarn build` fails to minify
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
# template_common
基础仓库模板
## 项目目录
```
项目目录
├── .drone.yml CI配置文件
├── .githooks githooks文件夹
│ ├── commit-msg
│ ├── pre-commit
│ └── pre-push
├── .gitignore git忽略文件
├── .releaserc semantic-release配置文件
├── Dockerfile docker打包文件
└── README.md 项目说明文件
```
## 项目流程
1. web 页面 fork **common** 组织下的相应仓库并设置具体见文档
2. `git clone` 到本地
3. 配置 .githooks
`git config core.hooksPath .githooks`
mac 和 linux 下
`chmod 700 .githooks/*`
4. 开发 见具体文档

Loading…
Cancel
Save