-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
35ff440
commit b36e640
Showing
6 changed files
with
120 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: '1.19' | ||
check-latest: true | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v3 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
project_name: bookimport | ||
|
||
before: | ||
hooks: | ||
- go mod tidy | ||
|
||
builds: | ||
- id: bookimport | ||
binary: bookimport | ||
gcflags: | ||
- all=-l -B | ||
ldflags: | ||
- -s -w | ||
- -X github.com/jianyun8023/bookimport/cmd.gitVersion={{ .Version }} | ||
- -X github.com/jianyun8023/bookimport/cmd.gitCommit={{ .Commit }} | ||
- -X github.com/jianyun8023/bookimport/cmd.buildDate={{ .Date }} | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- windows | ||
- darwin | ||
goarch: | ||
- "386" | ||
- amd64 | ||
- arm64 | ||
ignore: | ||
- goos: darwin | ||
goarch: "386" | ||
- goos: windows | ||
goarch: arm64 | ||
|
||
checksum: | ||
name_template: 'checksums.txt' | ||
|
||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^docs:' | ||
- '^test:' | ||
- '^web:' | ||
- '^build:' | ||
|
||
archives: | ||
- id: bookimport | ||
builds: | ||
- bookimport | ||
format: tar.gz | ||
wrap_in_directory: "true" | ||
format_overrides: | ||
- goos: windows | ||
format: zip | ||
|
||
release: | ||
draft: true | ||
|
||
snapshot: | ||
name_template: "{{ incminor .Version }}-next" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"github.com/spf13/cobra" | ||
"runtime" | ||
) | ||
|
||
var ( | ||
gitVersion = "" | ||
gitCommit = "" // sha1 from git, output of $(git rev-parse HEAD) | ||
buildDate = "" // build date in ISO8601 format, output of $(date -u +'%Y-%m-%dT%H:%M:%SZ') | ||
goVersion = runtime.Version() | ||
platform = fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH) | ||
) | ||
|
||
// versionCmd represents the version command. | ||
var versionCmd = &cobra.Command{ | ||
Use: "version", | ||
Short: "Return the bookimporter version info", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
fmt.Println("bookimporter version info") | ||
fmt.Printf(" - Version: %v\n", gitVersion) | ||
fmt.Printf(" - Commit: %v\n", gitCommit) | ||
fmt.Printf(" - Build Date: %v\n", buildDate) | ||
fmt.Printf(" - Go Version: %v\n", goVersion) | ||
fmt.Printf(" - Platform: %s\n", platform) | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module github.com/jianyun8023/bookImporter | ||
module github.com/jianyun8023/bookimporter | ||
|
||
go 1.18 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters