mirror of
https://github.com/apricote/releaser-pleaser.git
synced 2026-01-13 21:21:03 +00:00
feat: add support for GitLab repositories
This commit is contained in:
parent
5ea41654a7
commit
f29bbf51c1
5 changed files with 472 additions and 19 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
|
@ -9,6 +10,7 @@ import (
|
|||
"github.com/apricote/releaser-pleaser/internal/commitparser/conventionalcommits"
|
||||
"github.com/apricote/releaser-pleaser/internal/forge"
|
||||
"github.com/apricote/releaser-pleaser/internal/forge/github"
|
||||
"github.com/apricote/releaser-pleaser/internal/forge/gitlab"
|
||||
"github.com/apricote/releaser-pleaser/internal/updater"
|
||||
"github.com/apricote/releaser-pleaser/internal/versioning"
|
||||
)
|
||||
|
|
@ -39,6 +41,8 @@ func init() {
|
|||
func run(cmd *cobra.Command, _ []string) error {
|
||||
ctx := cmd.Context()
|
||||
|
||||
var err error
|
||||
|
||||
logger.DebugContext(ctx, "run called",
|
||||
"forge", flagForge,
|
||||
"branch", flagBranch,
|
||||
|
|
@ -53,9 +57,18 @@ func run(cmd *cobra.Command, _ []string) error {
|
|||
BaseBranch: flagBranch,
|
||||
}
|
||||
|
||||
switch flagForge { // nolint:gocritic // Will become a proper switch once gitlab is added
|
||||
// case "gitlab":
|
||||
// f = rp.NewGitLab(forgeOptions)
|
||||
switch flagForge {
|
||||
case "gitlab":
|
||||
logger.DebugContext(ctx, "using forge GitLab")
|
||||
f, err = gitlab.New(logger, &gitlab.Options{
|
||||
Options: forgeOptions,
|
||||
Path: flagOwner,
|
||||
Repo: flagRepo,
|
||||
})
|
||||
if err != nil {
|
||||
logger.ErrorContext(ctx, "failed to create client", "err", err)
|
||||
return fmt.Errorf("failed to create gitlab client: %w", err)
|
||||
}
|
||||
case "github":
|
||||
logger.DebugContext(ctx, "using forge GitHub")
|
||||
f = github.New(logger, &github.Options{
|
||||
|
|
@ -63,6 +76,8 @@ func run(cmd *cobra.Command, _ []string) error {
|
|||
Owner: flagOwner,
|
||||
Repo: flagRepo,
|
||||
})
|
||||
default:
|
||||
return fmt.Errorf("unknown --forge: %s", flagForge)
|
||||
}
|
||||
|
||||
extraFiles := parseExtraFiles(flagExtraFiles)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue