Skip to content

Commit

Permalink
Merge pull request #26 from TomVasile/upload-from-nested
Browse files Browse the repository at this point in the history
include option for nested dist
  • Loading branch information
bradrydzewski committed May 11, 2020
2 parents 04526ed + f001295 commit fa25cef
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ func main() {
Usage: "skip build and only upload pre-build packages",
EnvVar: "PLUGIN_SKIP_BUILD",
},
cli.StringFlag{
Name: "dist_dir",
Usage: "used when distribution directory is not in build root",
Value: "dist/",
EnvVar: "PLUGIN_DIST_DIR",
},
}

app.Run(os.Args)
Expand All @@ -65,6 +71,7 @@ func run(c *cli.Context) {
SetupFile: c.String("setupfile"),
Distributions: c.StringSlice("distributions"),
SkipBuild: c.Bool("skip_build"),
DistDir: c.String("dist_dir"),
}

if err := plugin.Exec(); err != nil {
Expand Down
4 changes: 3 additions & 1 deletion plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"log"
"os/exec"
"path/filepath"

"github.com/pkg/errors"
)
Expand All @@ -15,6 +16,7 @@ type Plugin struct {
SetupFile string
Distributions []string
SkipBuild bool
DistDir string
}

func (p Plugin) buildCommand() *exec.Cmd {
Expand All @@ -40,7 +42,7 @@ func (p Plugin) uploadCommand() *exec.Cmd {
args = append(args, p.Username)
args = append(args, "--password")
args = append(args, p.Password)
args = append(args, "dist/*")
args = append(args, filepath.Join(p.DistDir, "/*"))

return exec.Command("twine", args...)
}
Expand Down
1 change: 1 addition & 0 deletions plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func TestPublish(t *testing.T) {
SetupFile: "testdata/setup.py",
Distributions: strings.Split(os.Getenv("PLUGIN_DISTRIBUTIONS"), " "),
SkipBuild: false,
DistDir: "dist/",
}
err := plugin.Exec()
if err != nil {
Expand Down

0 comments on commit fa25cef

Please sign in to comment.