Skip to content

Commit

Permalink
feat: tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Runrioter committed Jan 14, 2025
1 parent 30faba7 commit b010f72
Show file tree
Hide file tree
Showing 10 changed files with 2,060 additions and 64 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/release-bin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ jobs:
run: make build

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v1
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
key: ${{ secrets.YOUR_PRIVATE_KEY }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
.vscode

# generated file
bank/bin.go
bank/name.go
# bank/bin.go
# bank/name.go

# resource
resource
Expand Down
9 changes: 3 additions & 6 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@ builds:
- linux
- darwin
- windows

universal_binaries:
- replace: false

archives:
- name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64

checksum:
# You can change the name of the checksums file.
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ build:
&& awk -f scripts/make-bin-go.awk $(DATABINFILE) > $(BINFILE) \
&& awk -f scripts/make-name-go.awk $(DATANAMEFILE) > $(NAMEFILE)

@echo ">> Formating and building" \
@echo ">> Golang formating and building" \
&& gofmt -l -w -s bank \
&& go build -v $(REPOPATH)

Expand All @@ -54,6 +54,7 @@ add:
@$(call sort_bin,$(DATABINFILE))

define sort_bin
echo "Sorting BIN file" && \
awk -f scripts/sort-bin.awk -v to=$(TMPBINFILE) $(1) \
&& mv $(TMPBINFILE) $(1)
endef
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
bcbc
bcbc [![PkgGoDev](https://pkg.go.dev/badge/github.com/hexindai/bcbc/bank)](https://pkg.go.dev/github.com/hexindai/bcbc/bank?tab=doc)
======

[![Github Workflows](https://github.com/hexindai/bcbc/workflows/bcbc-ci-wf/badge.svg)](https://github.com/hexindai/bcbc/actions?query=workflow%3Abcbc-ci-wf)
Expand Down Expand Up @@ -27,15 +27,15 @@ Show this command help
$ bcbc -h
```

#### As a cli
#### Cli

```bash
$ bcbc search -c 6222021234567890123 -o json

> {"bin":"622202","bank":"ICBC","name":"中国工商银行","type":"DC","length":19}
```

#### As a HTTP server
#### HTTP Server

```bash
$ bcbc serve -p :3232
Expand All @@ -45,13 +45,13 @@ $ curl http://127.0.0.1:3232/cardInfo.json?cardNo=6222021234567890123
> {"bin":"622202","bank":"ICBC","name":"中国工商银行","type":"DC","length":19}
```

#### As a library
#### Go package

See [![PkgGoDev](https://pkg.go.dev/badge/github.com/hexindai/bcbc/bank)](https://pkg.go.dev/github.com/hexindai/bcbc/bank?tab=doc)
See [pkg.go.dev](https://pkg.go.dev/github.com/hexindai/bcbc/bank)

## Contribution

* Add new BIN: `make add len=16 bin=621245`
* Add new BIN: `make add len=16 bin=621245` (need to install gawk)
* Build for generating source files: `make build`
* Change version in file `cmd/bcbc.go`
* Commit! (I will review and release it.)
Expand Down
1,716 changes: 1,716 additions & 0 deletions bank/bin.go

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion bank/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ Package bank provides China UnionPay CardBIN searching.
Get search card BIN:
resp, err := bank.Get("6222021234567890123")
*/
package bank
Loading

0 comments on commit b010f72

Please sign in to comment.