diff --git a/.github/changelog.yml b/.github/changelog.yml new file mode 100644 index 0000000..c1939cb --- /dev/null +++ b/.github/changelog.yml @@ -0,0 +1,37 @@ +title: '## Change Log' +# style allow: simple, markdown(mkdown), ghr(gh-release) +style: gh-release +# group names +names: [Refactor, Fixed, Feature, Update, Other] +# if empty will auto fetch by git remote +#repo_url: https://github.com/gookit/gitw + +filters: + # message length should >= 12 + - name: msg_len + min_len: 12 + # message words should >= 3 + - name: words_len + min_len: 3 + - name: keyword + keyword: format code + exclude: true + - name: keywords + keywords: format code, action test + exclude: true + +# group match rules +# not matched will use 'Other' group. +rules: + - name: Refactor + start_withs: [refactor, break] + contains: ['refactor:'] + - name: Fixed + start_withs: [fix] + contains: ['fix:'] + - name: Feature + start_withs: [feat, new] + contains: ['feat:'] + - name: Update + start_withs: [update, 'up:'] + contains: ['update:'] diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fc98675..0334f18 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,12 +12,12 @@ jobs: timeout-minutes: 10 strategy: fail-fast: true - matrix: - go: [1.17] steps: - name: Checkout uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Setup ENV # https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable @@ -25,13 +25,20 @@ jobs: echo "RELEASE_TAG=${GITHUB_REF:10}" >> $GITHUB_ENV echo "RELEASE_NAME=$GITHUB_WORKFLOW" >> $GITHUB_ENV - - name: Display Env - run: env + - name: Generate changelog + run: | + curl https://github.com/gookit/gitw/releases/latest/download/chlog-linux-amd64 -L -o /usr/local/bin/chlog + chmod a+x /usr/local/bin/chlog + chlog -c .github/changelog.yml -o changelog.md prev last - # https://github.com/actions/create-release - - uses: meeDamian/github-release@v2.0.3 + # https://github.com/softprops/action-gh-release + - name: Create release and upload assets + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - gzip: false - token: ${{ secrets.GITHUB_TOKEN }} - tag: ${{ env.RELEASE_TAG }} name: ${{ env.RELEASE_TAG }} + tag_name: ${{ env.RELEASE_TAG }} + body_path: changelog.md + token: ${{ secrets.GITHUB_TOKEN }} +# files: macos-chlog.exe diff --git a/README.md b/README.md index 1afa8ad..8a1f65d 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ go get github.com/gookit/gsr - [logger](logger.go) - [cacher](cacher.go) -- [marshaler](marshaler.go) +- [parser](parser.go) ## Usage @@ -75,11 +75,11 @@ func (ma *MyApp) SetCacher(cacher gsr.SimpleCacher) { } ``` -### Marshaler interface +### DataParser interface ```go -// Marshaler interface for Marshal/Unmarshal data -type Marshaler interface { +// DataParser interface for Marshal/Unmarshal data +type DataParser interface { Marshal(v interface{}) ([]byte, error) Unmarshal(data []byte, ptr interface{}) error } diff --git a/marshaler.go b/parser.go similarity index 88% rename from marshaler.go rename to parser.go index d20e181..caefa33 100644 --- a/marshaler.go +++ b/parser.go @@ -10,8 +10,8 @@ type Unmarshaler interface { Unmarshal(v []byte, ptr interface{}) error } -// DataMarshaler interface for Marshal/Unmarshal data -type DataMarshaler interface { +// DataParser interface for Marshal/Unmarshal data +type DataParser interface { Marshaler Unmarshaler }