Skip to content

Commit fa25cef

Browse files
Merge pull request #26 from TomVasile/upload-from-nested
include option for nested dist
2 parents 04526ed + f001295 commit fa25cef

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

main.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ func main() {
5252
Usage: "skip build and only upload pre-build packages",
5353
EnvVar: "PLUGIN_SKIP_BUILD",
5454
},
55+
cli.StringFlag{
56+
Name: "dist_dir",
57+
Usage: "used when distribution directory is not in build root",
58+
Value: "dist/",
59+
EnvVar: "PLUGIN_DIST_DIR",
60+
},
5561
}
5662

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

7077
if err := plugin.Exec(); err != nil {

plugin.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main
33
import (
44
"log"
55
"os/exec"
6+
"path/filepath"
67

78
"github.com/pkg/errors"
89
)
@@ -15,6 +16,7 @@ type Plugin struct {
1516
SetupFile string
1617
Distributions []string
1718
SkipBuild bool
19+
DistDir string
1820
}
1921

2022
func (p Plugin) buildCommand() *exec.Cmd {
@@ -40,7 +42,7 @@ func (p Plugin) uploadCommand() *exec.Cmd {
4042
args = append(args, p.Username)
4143
args = append(args, "--password")
4244
args = append(args, p.Password)
43-
args = append(args, "dist/*")
45+
args = append(args, filepath.Join(p.DistDir, "/*"))
4446

4547
return exec.Command("twine", args...)
4648
}

plugin_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ func TestPublish(t *testing.T) {
1717
SetupFile: "testdata/setup.py",
1818
Distributions: strings.Split(os.Getenv("PLUGIN_DISTRIBUTIONS"), " "),
1919
SkipBuild: false,
20+
DistDir: "dist/",
2021
}
2122
err := plugin.Exec()
2223
if err != nil {

0 commit comments

Comments
 (0)