Skip to content

Commit

Permalink
create worktree before adding packages
Browse files Browse the repository at this point in the history
  • Loading branch information
gaelgatelement committed Sep 19, 2023
1 parent 555aefd commit 98575dc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pkg/releaser/releaser.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,12 @@ func (r *Releaser) CreateReleases() error {
return errors.Errorf("no charts found at %s", r.config.PackagePath)
}

worktree, err := r.git.AddWorktree("", r.config.Remote+"/"+r.config.PagesBranch)
if err != nil {
return err
}
defer r.git.RemoveWorktree("", worktree) //nolint: errcheck

for _, p := range packages {
ch, err := loader.LoadFile(p)
if err != nil {
Expand Down Expand Up @@ -346,12 +352,6 @@ func (r *Releaser) CreateReleases() error {
}

if r.config.PackagesWithIndex {
worktree, err := r.git.AddWorktree("", r.config.Remote+"/"+r.config.PagesBranch)
if err != nil {
return err
}
defer r.git.RemoveWorktree("", worktree) //nolint: errcheck

pkgTargetPath := filepath.Join(worktree, filepath.Base(p))
if err := copyFile(p, pkgTargetPath); err != nil {
return err
Expand Down

0 comments on commit 98575dc

Please sign in to comment.