Skip to content

Commit

Permalink
up: update some code style and update gh release script
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Aug 9, 2022
1 parent 8021f6c commit 64ddf53
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 25 deletions.
8 changes: 4 additions & 4 deletions .github/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ 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/config
#repo_url: https://github.com/gookit/goutil

filters:
# message length should >= 12
Expand All @@ -31,7 +31,7 @@ rules:
contains: ['fix:']
- name: Feature
start_withs: [feat, new]
contains: [feature]
contains: [feature, 'feat:']
- name: Update
start_withs: [update, 'up:']
contains: [' update']
start_withs: [up]
contains: ['update:', 'up:']
15 changes: 4 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,13 @@ jobs:
timeout-minutes: 10
strategy:
fail-fast: true
matrix:
go_version: [1.17]

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Go Faster
uses: WillAbides/setup-go-faster@v1.7.0
timeout-minutes: 3
with:
go-version: ${{ matrix.go_version }}

- name: Setup ENV
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
run: |
Expand All @@ -35,8 +27,9 @@ jobs:
- name: Generate changelog
run: |
go install github.com/gookit/gitw/cmd/chlog@latest
chlog -c .github/changelog.yml -o testdata/changelog.md prev last
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/softprops/action-gh-release
- name: Create release and upload assets
Expand All @@ -46,6 +39,6 @@ jobs:
with:
name: ${{ env.RELEASE_TAG }}
tag_name: ${{ env.RELEASE_TAG }}
body_path: testdata/changelog.md
body_path: changelog.md
token: ${{ secrets.GITHUB_TOKEN }}
# files: macos-chlog.exe
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/gookit/config/v2

go 1.15
go 1.16

require (
github.com/BurntSushi/toml v1.2.0
Expand Down
5 changes: 4 additions & 1 deletion json5/json5.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import (
// NAME for driver
const NAME = "json5"

// Name for driver
const Name = "json5"

// JSONMarshalIndent if not empty, will use json.MarshalIndent for encode data.
var JSONMarshalIndent string

Expand All @@ -26,5 +29,5 @@ var (
}

// Driver for json5
Driver = config.NewDriver(NAME, Decoder, Encoder)
Driver = config.NewDriver(Name, Decoder, Encoder)
)
8 changes: 4 additions & 4 deletions json5/json5_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ func Example() {
func TestDriver(t *testing.T) {
is := assert.New(t)

is.Equal(json5.NAME, json5.Driver.Name())
is.Equal(json5.Name, json5.Driver.Name())

c := config.NewEmpty("test")
is.False(c.HasDecoder(json5.NAME))
is.False(c.HasDecoder(json5.Name))
c.AddDriver(json5.Driver)

is.True(c.HasDecoder(json5.NAME))
is.True(c.HasEncoder(json5.NAME))
is.True(c.HasDecoder(json5.Name))
is.True(c.HasEncoder(json5.Name))

m := struct {
N string
Expand Down
8 changes: 4 additions & 4 deletions properties/properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"github.com/gookit/properties"
)

// DriverName string
const DriverName = "properties"
// Name string
const Name = "properties"

var (
// Decoder the properties content decoder
Expand All @@ -21,6 +21,6 @@ var (
// Encoder the properties content encoder
Encoder config.Encoder = properties.Encode

// Driver for yaml
Driver = config.NewDriver(DriverName, Decoder, Encoder)
// Driver for properties
Driver = config.NewDriver(Name, Decoder, Encoder)
)

0 comments on commit 64ddf53

Please sign in to comment.