Introduce optional flag for dist directory

This commit is contained in:
TomVasile
2020-04-21 21:17:04 +00:00
parent 0e0ddeaf4e
commit f140ca3828
2 changed files with 9 additions and 1 deletions
+7
View File
@@ -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)
@@ -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 {
+2 -1
View File
@@ -16,6 +16,7 @@ type Plugin struct {
SetupFile string
Distributions []string
SkipBuild bool
DistDir string
}
func (p Plugin) buildCommand() *exec.Cmd {
@@ -41,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, filepath.Join(filepath.Dir(p.SetupFile), "dist/*"))
args = append(args, filepath.Join(filepath.Dir(p.DistDir), "/*"))
return exec.Command("twine", args...)
}