0
0
mirror of https://github.com/thegeeklab/wp-s3-action.git synced 2024-11-21 14:50:39 +00:00

use the workspace like im supposed to

This commit is contained in:
Nathan LaFreniere 2015-11-13 16:17:17 -08:00
parent 35eeba4167
commit 4fe42e20b4

12
main.go
View File

@ -8,6 +8,7 @@ import (
"path/filepath"
"strings"
"github.com/drone/drone-go/drone"
"github.com/drone/drone-go/plugin"
"launchpad.net/goamz/aws"
"launchpad.net/goamz/s3"
@ -193,8 +194,10 @@ func (aws *AWS) Cleanup() error {
func main() {
vargs := PluginArgs{}
workspace := drone.Workspace{}
plugin.Param("vargs", &vargs)
plugin.Param("workspace", &workspace)
if err := plugin.Parse(); err != nil {
fmt.Println(err)
os.Exit(1)
@ -211,14 +214,7 @@ func main() {
if len(vargs.Source) == 0 {
vargs.Source = "."
}
wd, err := os.Getwd()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
vargs.Source = filepath.Join(wd, vargs.Source)
vargs.Source = filepath.Join(workspace.Path, vargs.Source)
if strings.HasPrefix(vargs.Target, "/") {
vargs.Target = vargs.Target[1:]