fix: fix publisher command
fix: fix ci pipeline to include publish testing
This commit is contained in:
parent
4153035eae
commit
5e8bc4b7f0
3 changed files with 112 additions and 2 deletions
|
|
@ -8,11 +8,13 @@ import (
|
|||
"io/fs"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Provider struct {
|
||||
RootPath string
|
||||
Namespace string
|
||||
Provider string
|
||||
DistPath string
|
||||
|
|
@ -23,6 +25,17 @@ type Provider struct {
|
|||
Domain string
|
||||
}
|
||||
|
||||
func (p *Provider) GetRoot() error {
|
||||
cmd := exec.Command("git", "rev-parse", "--show-toplevel")
|
||||
out, err := cmd.Output()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
lines := strings.Split(string(out), "\n")
|
||||
p.RootPath = lines[0]
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *Provider) CreateV1Dir() error {
|
||||
// Path to semantic version dir
|
||||
versionPath := p.providerDirs()
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import (
|
|||
"io/fs"
|
||||
"log"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
|
||||
publish2 "github.com/mhenselin/terraform-provider-stackitprivatepreview/cmd/cmd/publish"
|
||||
|
|
@ -96,10 +97,14 @@ func publish() error {
|
|||
GpgPubKeyFile: gpgPubKeyFile,
|
||||
Domain: domain,
|
||||
}
|
||||
err := p.GetRoot()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Create release dir - only the contents of this need to be uploaded to S3
|
||||
log.Printf("* Creating reelase directory")
|
||||
err := os.Mkdir("release", os.ModePerm)
|
||||
err = os.Mkdir(path.Join(p.RootPath, "release"), os.ModePerm)
|
||||
if !errors.Is(err, fs.ErrExist) {
|
||||
return fmt.Errorf("error creating 'release' dir: %w", err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue