Skip to content

Commit

Permalink
chore: add commitlint
Browse files Browse the repository at this point in the history
  • Loading branch information
JOU-amjs committed Apr 8, 2023
1 parent 94085e6 commit 7e3b181
Show file tree
Hide file tree
Showing 8 changed files with 839 additions and 104 deletions.
40 changes: 0 additions & 40 deletions .github/workflows/main.yml

This file was deleted.

71 changes: 71 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: build

# 触发条件:在 push或合并请求 到 master 或 release开头的分支后
on:
push:
branches:
- main
- alpha
- beta
pull_request:
branches: '*'

# 任务
jobs:
quality:
# 服务器环境:最新版 Ubuntu
runs-on: ubuntu-latest
steps:
# 拉取代码
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18.12.x
registry-url: 'https://registry.npmjs.org'
cache: 'npm'

# 执行测试和打包操作
- name: Install deps
run: npm ci

- name: Lint check
run: npm run lint

# 这条命令包含了测试
- name: Unit tests
run: npm run test

release:
runs-on: ubuntu-latest
needs: [quality]
if: ${{ github.ref == 'refs/heads/main' }}
steps:
# 拉取代码
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18.12.x
registry-url: 'https://registry.npmjs.org'
cache: 'npm'

# 执行测试和打包操作
- name: Install deps
run: npm ci

# 这条命令包含了测试和上传覆盖率
- name: Coverage
run: npm run coveralls

# 打包发布
- name: Build
run: npm run build --if-present

- name: Release
run: npm run release
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ALOVA_PUBLISH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no-install commitlint --edit $1
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run lint
6 changes: 6 additions & 0 deletions .releaserc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
branches:
- main
- name: beta
prerelease: true
- name: alpha
prerelease: true
3 changes: 3 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@commitlint/config-conventional']
};
Loading

0 comments on commit 7e3b181

Please sign in to comment.