✨ RDS Allow use zip
All checks were successful
release-nightly / build-docker (push) Successful in 1m8s
All checks were successful
release-nightly / build-docker (push) Successful in 1m8s
This commit is contained in:
parent
949f3d893b
commit
af606cb476
@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"code.smartsheep.studio/goatworks/roadsign/pkg/cmd/rds/conn"
|
"code.smartsheep.studio/goatworks/roadsign/pkg/cmd/rds/conn"
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
@ -31,17 +32,19 @@ var DeployCommands = []*cli.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prepare file to upload
|
// Prepare file to upload
|
||||||
|
workdir, _ := os.Getwd()
|
||||||
|
var filename string
|
||||||
|
if ctx.Args().Len() < 3 || !strings.HasSuffix(ctx.Args().Get(3), ".zip") {
|
||||||
log.Info().Msg("Preparing file to upload, please stand by...")
|
log.Info().Msg("Preparing file to upload, please stand by...")
|
||||||
|
|
||||||
filelist, err := archiver.FilesFromDisk(&archiver.FromDiskOptions{FollowSymlinks: true}, map[string]string{
|
filelist, err := archiver.FilesFromDisk(nil, map[string]string{
|
||||||
lo.Ternary(ctx.Args().Len() > 3, ctx.Args().Get(4), "."): "",
|
lo.Ternary(ctx.Args().Len() > 3, ctx.Args().Get(4), "."): "",
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to prepare file: %q", err)
|
return fmt.Errorf("failed to prepare file: %q", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
workdir, _ := os.Getwd()
|
filename = filepath.Join(workdir, fmt.Sprintf("rds-deploy-cache-%s.zip", uuid.NewString()))
|
||||||
filename := filepath.Join(workdir, fmt.Sprintf("rds-deploy-cache-%s.zip", uuid.NewString()))
|
|
||||||
out, err := os.Create(filename)
|
out, err := os.Create(filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to prepare file: %q", err)
|
return fmt.Errorf("failed to prepare file: %q", err)
|
||||||
@ -51,6 +54,9 @@ var DeployCommands = []*cli.Command{
|
|||||||
if err := (archiver.Zip{}).Archive(context.Background(), out, filelist); err != nil {
|
if err := (archiver.Zip{}).Archive(context.Background(), out, filelist); err != nil {
|
||||||
return fmt.Errorf("failed to prepare file: %q", err)
|
return fmt.Errorf("failed to prepare file: %q", err)
|
||||||
}
|
}
|
||||||
|
} else if ctx.Args().Len() > 3 {
|
||||||
|
filename = ctx.Args().Get(3)
|
||||||
|
}
|
||||||
|
|
||||||
// Send request
|
// Send request
|
||||||
log.Info().Msg("Now publishing to remote server...")
|
log.Info().Msg("Now publishing to remote server...")
|
||||||
|
Loading…
Reference in New Issue
Block a user