mirror of
https://github.com/thegeeklab/wp-s3-action.git
synced 2024-11-22 01:00:40 +00:00
use the workspace like im supposed to
This commit is contained in:
parent
35eeba4167
commit
4fe42e20b4
12
main.go
12
main.go
@ -8,6 +8,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/drone/drone-go/drone"
|
||||||
"github.com/drone/drone-go/plugin"
|
"github.com/drone/drone-go/plugin"
|
||||||
"launchpad.net/goamz/aws"
|
"launchpad.net/goamz/aws"
|
||||||
"launchpad.net/goamz/s3"
|
"launchpad.net/goamz/s3"
|
||||||
@ -193,8 +194,10 @@ func (aws *AWS) Cleanup() error {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
vargs := PluginArgs{}
|
vargs := PluginArgs{}
|
||||||
|
workspace := drone.Workspace{}
|
||||||
|
|
||||||
plugin.Param("vargs", &vargs)
|
plugin.Param("vargs", &vargs)
|
||||||
|
plugin.Param("workspace", &workspace)
|
||||||
if err := plugin.Parse(); err != nil {
|
if err := plugin.Parse(); err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
@ -211,14 +214,7 @@ func main() {
|
|||||||
if len(vargs.Source) == 0 {
|
if len(vargs.Source) == 0 {
|
||||||
vargs.Source = "."
|
vargs.Source = "."
|
||||||
}
|
}
|
||||||
|
vargs.Source = filepath.Join(workspace.Path, vargs.Source)
|
||||||
wd, err := os.Getwd()
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println(err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
vargs.Source = filepath.Join(wd, vargs.Source)
|
|
||||||
|
|
||||||
if strings.HasPrefix(vargs.Target, "/") {
|
if strings.HasPrefix(vargs.Target, "/") {
|
||||||
vargs.Target = vargs.Target[1:]
|
vargs.Target = vargs.Target[1:]
|
||||||
|
Loading…
Reference in New Issue
Block a user