From b67bed44130291bf789954c6b271f8b9950b1dff Mon Sep 17 00:00:00 2001 From: ikawaha Date: Fri, 16 Oct 2020 22:08:18 +0900 Subject: [PATCH 1/2] Change the location of the command files (#213) --- Dockerfile | 2 +- README.md | 2 +- app.json | 4 ++-- cmd/{kagome => }/lattice/cmd.go | 0 cmd/{kagome => }/server/api.go | 0 cmd/{kagome => }/server/cmd.go | 0 cmd/{kagome => }/server/demo.go | 0 cmd/{kagome => }/tokenize/cmd.go | 0 cmd/kagome/main.go => main.go | 6 +++--- 9 files changed, 7 insertions(+), 7 deletions(-) rename cmd/{kagome => }/lattice/cmd.go (100%) rename cmd/{kagome => }/server/api.go (100%) rename cmd/{kagome => }/server/cmd.go (100%) rename cmd/{kagome => }/server/demo.go (100%) rename cmd/{kagome => }/tokenize/cmd.go (100%) rename cmd/kagome/main.go => main.go (94%) diff --git a/Dockerfile b/Dockerfile index 39dbebdc..436f3e0a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,7 +27,7 @@ RUN \ CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} GOARM=${GOARM} go build \ --ldflags "-w -s -extldflags \"-static\" -X 'main.version=${version_app}'" \ -o /go/bin/kagome \ - /go/src/github.com/ikawaha/kagome/cmd/kagome && \ + /go/src/github.com/ikawaha/kagome && \ echo "- Smoke test (run kagome version command) ... $(/go/bin/kagome version)" # 2nd stage: Copy only the built binary to shrink the image size. diff --git a/README.md b/README.md index 31f27f74..f7c1d740 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,7 @@ output: ## Install ```shellsession -env GO111MODULE=on go get -u github.com/ikawaha/kagome/v2/... +env GO111MODULE=on go get -u github.com/ikawaha/kagome/v2 ``` ## Usage diff --git a/app.json b/app.json index 1db09b01..25a1145b 100644 --- a/app.json +++ b/app.json @@ -2,8 +2,8 @@ "name": "kagome", "description": "Kagome Japanese Morphological Analyzer", "env": { - "GOVERSION": "go1.14", - "GO_INSTALL_PACKAGE_SPEC": "./cmd/kagome" + "GOVERSION": "go1.15", + "GO_INSTALL_PACKAGE_SPEC": "." }, "buildpacks": [ { diff --git a/cmd/kagome/lattice/cmd.go b/cmd/lattice/cmd.go similarity index 100% rename from cmd/kagome/lattice/cmd.go rename to cmd/lattice/cmd.go diff --git a/cmd/kagome/server/api.go b/cmd/server/api.go similarity index 100% rename from cmd/kagome/server/api.go rename to cmd/server/api.go diff --git a/cmd/kagome/server/cmd.go b/cmd/server/cmd.go similarity index 100% rename from cmd/kagome/server/cmd.go rename to cmd/server/cmd.go diff --git a/cmd/kagome/server/demo.go b/cmd/server/demo.go similarity index 100% rename from cmd/kagome/server/demo.go rename to cmd/server/demo.go diff --git a/cmd/kagome/tokenize/cmd.go b/cmd/tokenize/cmd.go similarity index 100% rename from cmd/kagome/tokenize/cmd.go rename to cmd/tokenize/cmd.go diff --git a/cmd/kagome/main.go b/main.go similarity index 94% rename from cmd/kagome/main.go rename to main.go index 99900150..fb549946 100644 --- a/cmd/kagome/main.go +++ b/main.go @@ -6,9 +6,9 @@ import ( "os" "path/filepath" - "github.com/ikawaha/kagome/v2/cmd/kagome/lattice" - "github.com/ikawaha/kagome/v2/cmd/kagome/server" - "github.com/ikawaha/kagome/v2/cmd/kagome/tokenize" + "github.com/ikawaha/kagome/v2/cmd/lattice" + "github.com/ikawaha/kagome/v2/cmd/server" + "github.com/ikawaha/kagome/v2/cmd/tokenize" ) type subcommand struct { From f332765326059dfc9925a4d49954f34675125522 Mon Sep 17 00:00:00 2001 From: ikawaha Date: Wed, 28 Oct 2020 09:20:50 +0900 Subject: [PATCH 2/2] Add release settings (#217) --- .github/workflows/release.yml | 27 +++++++++++++++++++++++++ .goreleaser.yml | 38 +++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..1cbf7324 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,27 @@ +name: Release + +on: + workflow_dispatch: + push: + tags: + - 'v' + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: '1.15.x' + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + args: release --rm-dist --config .goreleaser.yml + env: + GITHUB_TOKEN: ${{ github.token }} \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 00000000..d74c6090 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,38 @@ +env: + - GO111MODULE=on +before: + hooks: + - go mod download +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - darwin + - windows + goarch: + - 386 + - amd64 + - arm + - arm64 + mod_timestamp: '{{ .CommitTimestamp }}' + flags: + - -trimpath + ldflags: + - -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{ .CommitDate }} -X main.builtBy=goreleaser +brews: + - + tap: + owner: ikawaha + name: homebrew-kagome + commit_author: + name: goreleaserbot + email: goreleaser@carlosbecker.com + description: "Self-contained Japanese Morphological Analyzer written in pure Go." + homepage: "https://github.com/ikawaha/kagome" + dependencies: + - go + install: | + bin.install Dir['kagome'] + test: | + system "#{bin}/kagome" \ No newline at end of file