Skip to content

Commit

Permalink
Merge branch 'main' into support_pgv
Browse files Browse the repository at this point in the history
  • Loading branch information
WineChord committed Oct 20, 2023
2 parents f206142 + 37d7d5c commit 80a3e6e
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 7 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
on:
release:
types: [created]

permissions:
contents: write
packages: write

jobs:
release-linux-darwin-windows-amd64:
name: release linux/amd64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout submodules using a PAT
run: |
git config --file .gitmodules --get-regexp url | while read url; do
git config --file=.gitmodules $(echo "$url" | sed -E "s/[email protected]:|https:\/\/github.com\//https:\/\/${{ secrets.TRPC_PAT }}:${{ secrets.TRPC_PAT }}@github.com\//")
done
git submodule sync
git submodule update --init --recursive
- uses: wangyoucao577/go-release-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: linux
goarch: amd64
project_path: ./trpc
binary_name: trpc_linux
- uses: wangyoucao577/go-release-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: darwin
goarch: amd64
project_path: ./trpc
binary_name: trpc_darwin
- uses: wangyoucao577/go-release-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: windows
goarch: amd64
project_path: ./trpc
binary_name: trpc_windows.exe
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Change Log

# v1.0.3 2023-10-20

- version: update version (#17)

# v1.0.2 2023-10-20

- docs: add changelog (#15)

# v1.0.1 2023-10-20

- config: replace os (#13)
- gomod: upgrade golang.org/x/net (#9)
- version: update version (#8)
- go.mod: update dependencies (#7)

# v1.0.0 2023-10-17

- initial release
1 change: 1 addition & 0 deletions cmd/create/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ func Test_CreateCmd(t *testing.T) {
opts = append(opts, "--protofile", tt.pbfile)
opts = append(opts, "-o", out)
opts = append(opts, "--check-update", "true")
opts = append(opts, "-v")

if tt.rpconly {
opts = append(opts, "--rpconly")
Expand Down
9 changes: 7 additions & 2 deletions cmd/create/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"fmt"
"os"
"path/filepath"
"strings"

"github.com/pkg/errors"
"github.com/spf13/pflag"
Expand Down Expand Up @@ -165,6 +166,10 @@ func (c *Create) fixProtoDirs() error {

if c.options.UseBaseName {
c.options.Protofile = filepath.Base(target)
} else if filepath.IsAbs(c.options.Protofile) {
c.options.Protofile = strings.TrimPrefix(c.options.Protofile, "/")
} else {
c.options.Protofile = strings.TrimPrefix(c.options.Protofile, "./")
}

c.options.ProtofileAbs = target
Expand Down Expand Up @@ -412,8 +417,8 @@ func (c *Create) parsePBIDLOptions(flags *pflag.FlagSet) error {
if err != nil {
return fmt.Errorf("flags get protodir string array failed err: %w", err)
}
// Always append the current working directory.
c.options.Protodirs = fs.UniqFilePath(append(dirs, "."))
// Always append the current working directory and root directory.
c.options.Protodirs = fs.UniqFilePath(append(dirs, ".", "/"))
c.options.Protofile, err = flags.GetString("protofile")
if err != nil {
return fmt.Errorf("flags get protofile string failed err: %w", err)
Expand Down
1 change: 1 addition & 0 deletions config/def.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ type Dependency struct {

// TryInstallTo tries to install the dependency to the given path.
func (d *Dependency) TryInstallTo(path string) error {
d.ArtifactURL = strings.ReplaceAll(d.ArtifactURL, "${os}", runtime.GOOS)
rsp, err := http.Get(d.ArtifactURL)
if err != nil {
return fmt.Errorf("install %s from %s err: %w", d.Executable, d.ArtifactURL, err)
Expand Down
2 changes: 1 addition & 1 deletion config/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
package config

// TRPCCliVersion is the version of trpc-cmdline tool.
var TRPCCliVersion = "v1.0.0"
var TRPCCliVersion = "v1.0.3"
2 changes: 1 addition & 1 deletion gobin/assets.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion install/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.0.0
v1.0.3
3 changes: 1 addition & 2 deletions util/fs/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ func LocateFile(protofile string, protodirs []string) (string, error) {

// If we can find the protofile under the current directory,
// directly return to prevent possible conflicts resulting from the relative path in protofile.
// Reference: https://mk.woa.com/q/286784
fp := filepath.Join(abs, protofile)
if info, err := os.Lstat(fp); err == nil && !info.IsDir() {
return fp, nil
Expand All @@ -61,7 +60,7 @@ func LocateFile(protofile string, protodirs []string) (string, error) {
log.Debug("protodirs: %s", protodirs)
fpaths, err := getPbFilePathList(protofile, protodirs)
if err != nil {
return "", fmt.Errorf("get pb file path listerr: %w", err)
return "", fmt.Errorf("get pb file path list err: %w", err)
}

// `-protofile=abc/d.proto`, works like `-protodir=abc -protofile=d.proto`
Expand Down

0 comments on commit 80a3e6e

Please sign in to comment.