Skip to content

Commit 961bbff

Browse files
committed
up: update readme and add auto gen changelog on release
1 parent 182adfc commit 961bbff

File tree

5 files changed

+87
-36
lines changed

5 files changed

+87
-36
lines changed

.github/changelog.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
title: '## Change Log'
2+
# style allow: simple, markdown(mkdown), ghr(gh-release)
3+
style: gh-release
4+
# group names
5+
names: [Refactor, Fixed, Feature, Update, Other]
6+
#repo_url: https://github.com/gookit/gcli
7+
8+
filters:
9+
# message length should >= 12
10+
- name: msg_len
11+
min_len: 12
12+
# message words should >= 3
13+
- name: words_len
14+
min_len: 3
15+
- name: keyword
16+
keyword: format code
17+
exclude: true
18+
- name: keywords
19+
keywords: format code, action test
20+
exclude: true
21+
22+
# group match rules
23+
# not matched will use 'Other' group.
24+
rules:
25+
- name: Refactor
26+
start_withs: [refactor, break]
27+
contains: ['refactor:']
28+
- name: Fixed
29+
start_withs: [fix]
30+
contains: ['fix:']
31+
- name: Feature
32+
start_withs: [feat, new]
33+
contains: [feature]
34+
- name: Update
35+
start_withs: [update, 'up:']
36+
contains: []

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: composer
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
open-pull-requests-limit: 10
8+
9+
- package-ecosystem: "github-actions"
10+
directory: "/"
11+
schedule:
12+
# Check for updates to GitHub Actions every weekday
13+
interval: "daily"

.github/workflows/php.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
fail-fast: true
1919
matrix:
20-
php: [7.3, 7.4, 8.0] # 7.1, 7.2,
20+
php: [7.3, 7.4, 8.0, 8.1] # 7.1, 7.2,
2121
os: [ubuntu-latest] # windows-latest, macOS-latest
2222
include:
2323
- os: 'ubuntu-latest'
@@ -29,7 +29,7 @@ jobs:
2929

3030
steps:
3131
- name: Checkout
32-
uses: actions/checkout@v2
32+
uses: actions/checkout@v3
3333

3434
# usage refer https://github.com/shivammathur/setup-php
3535
- name: Setup PHP

.github/workflows/release.yml

Lines changed: 15 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,50 +13,31 @@ jobs:
1313
strategy:
1414
fail-fast: true
1515
matrix:
16-
php: [7.3]
16+
php: [8.1]
1717

1818
steps:
1919
- name: Checkout
20-
uses: actions/checkout@v2
20+
uses: actions/checkout@v3
2121

2222
- name: Set ENV for github-release
2323
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
2424
run: |
2525
echo "RELEASE_TAG=${GITHUB_REF:10}" >> $GITHUB_ENV
2626
echo "RELEASE_NAME=$GITHUB_WORKFLOW" >> $GITHUB_ENV
2727
28-
# usage refer https://github.com/shivammathur/setup-php
29-
- name: Setup PHP
30-
timeout-minutes: 5
31-
uses: shivammathur/setup-php@v2
32-
with:
33-
php-version: ${{ matrix.php}}
34-
tools: pecl, php-cs-fixer, phpunit
35-
extensions: mbstring, dom, fileinfo, mysql, openssl # , swoole-4.4.19 #optional, setup extensions
36-
ini-values: post_max_size=56M, short_open_tag=On #optional, setup php.ini configuration
37-
coverage: none #optional, setup coverage driver: xdebug, none
38-
39-
- name: Install dependencies # eg: v1.0.3
28+
- name: Generate changelog
4029
run: |
41-
tag1=${GITHUB_REF#refs/*/}
42-
echo "release tag: ${tag1}"
43-
composer install --no-progress --no-suggest
44-
45-
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
46-
# Docs: https://getcomposer.org/doc/articles/scripts.md
47-
48-
# - name: Build phar and send to github assets
49-
# run: |
50-
# echo $RELEASE_TAG
51-
# echo $RELEASE_NAME
52-
# php -d phar.readonly=0 bin/kite phar:pack -o kite-${RELEASE_TAG}.phar --no-progress
53-
# php kite-${RELEASE_TAG}.phar -V
54-
55-
# https://github.com/actions/create-release
56-
- uses: meeDamian/github-release@2.0
30+
curl https://github.com/gookit/gitw/releases/latest/download/chlog-linux-amd64 -L -o /usr/local/bin/chlog
31+
chmod a+x /usr/local/bin/chlog
32+
chlog -c .github/changelog.yml -o changelog.md prev last
33+
34+
# https://github.com/softprops/action-gh-release
35+
- name: Create release and upload assets
36+
uses: softprops/action-gh-release@v1
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5739
with:
58-
gzip: false
59-
token: ${{ secrets.GITHUB_TOKEN }}
60-
tag: ${{ env.RELEASE_TAG }}
6140
name: ${{ env.RELEASE_TAG }}
62-
# files: kite-${{ env.RELEASE_TAG }}.phar
41+
tag_name: ${{ env.RELEASE_TAG }}
42+
body_path: changelog.md
43+
token: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,27 @@ $v->setSecne('update')->validate();
657657

658658
```
659659

660+
## 选项设置
661+
662+
### `StopOnError`
663+
664+
`stopOnError` 是否在出现第一个验证错误时就停止验证。
665+
666+
- 默认 `true`, 总是只会拿到第一个错误,这样性能更好。
667+
- 设置为 `false`, 则会检查全部规则,拿到全部的验证错误。
668+
669+
```php
670+
$v->setStopOnError(false);
671+
```
672+
673+
### `SkipOnEmpty`
674+
675+
- `SkipOnEmpty` 为空是否跳过验证, 默认 `true` (此时需配合 `required` 验证不可为空)
676+
677+
```php
678+
$v->setSkipOnEmpty(false);
679+
```
680+
660681
<a name="built-in-filters"></a>
661682

662683
## 内置的过滤器

0 commit comments

Comments
 (0)