Skip to content

Commit

Permalink
fix: get go versionNum
Browse files Browse the repository at this point in the history
  • Loading branch information
seekwe committed Jun 10, 2022
1 parent 36015a0 commit f104969
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
29 changes: 16 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,24 @@ on:
- v*

jobs:
release:
name: Release on GitHub
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v1

- name: Validates GO releaser config
uses: docker://goreleaser/goreleaser:latest
- name: Checkout
uses: actions/checkout@v2
with:
args: check

- name: Create release on GitHub
uses: docker://goreleaser/goreleaser:latest
fetch-depth: 0
- name: Fetch all tags
run: git fetch --force --tags
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
args: release
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9 changes: 7 additions & 2 deletions cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,13 @@ var buildCmd = &cobra.Command{
%[1]s %[2]s --pack -- -o output
%[1]s %[2]s --os win,mac,linux --go 1.11`, use, buildUse),
Run: func(cmd *cobra.Command, args []string) {
version := build.GetGoVersion()
versionNum := ztype.ToFloat64(strings.Split(strings.Replace(version, "go", "", 1), " ")[0])
version, versionNum := build.GetGoVersion(), float64(0)
v := strings.Split(strings.Split(strings.Replace(version, "go", "", 1), " ")[0], ".")
if len(v) > 1 {
versionNum = ztype.ToFloat64(strings.Join(v[:2], "."))
} else {
versionNum = ztype.ToFloat64(strings.Join(v, "."))
}
if zutil.Getenv("ENABLECGO") == "" {
zshell.Env = []string{"ENABLECGO=0"}
}
Expand Down
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,6 @@ golang.org/x/net v0.0.0-20210502030024-e5908800b52b/go.mod h1:OJAsFXCWl8Ukc7SiCT
golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f h1:oA4XRj0qtSt8Yo1Zms0CUlsT3KG69V2UGQWPBxujDmc=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220325170049-de3da57026de h1:pZB1TWnKi+o4bENlbzAgLrEbY4RMYmUIRobMcSmfeYc=
golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
Expand Down Expand Up @@ -615,8 +613,6 @@ golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 h1:OH54vjqzRWmbJ62fjuhxy7AxFFgoHN0/DPc/UrL8cAs=
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f h1:rlezHXNlxYWvBCzNses9Dlc7nGFaNMJeqLolcmQSSZY=
golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
Expand Down

0 comments on commit f104969

Please sign in to comment.