mirror of
https://github.com/drone-plugins/drone-pypi.git
synced 2026-06-04 10:15:06 +08:00
Merge pull request #26 from TomVasile/upload-from-nested
include option for nested dist
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"log"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
@@ -15,6 +16,7 @@ type Plugin struct {
|
||||
SetupFile string
|
||||
Distributions []string
|
||||
SkipBuild bool
|
||||
DistDir string
|
||||
}
|
||||
|
||||
func (p Plugin) buildCommand() *exec.Cmd {
|
||||
@@ -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...)
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user