From 1e7c72cb863eb81c3603b03d072c421911628b8c Mon Sep 17 00:00:00 2001 From: Christoph Witzko <github@christophwitzko.com> Date: Fri, 3 Feb 2023 17:44:12 +0100 Subject: [PATCH] feat: add known github plugins --- .../discovery/resolver/github/github.go | 6 +++++ .../resolver/github/known_plugins.go | 27 ++++++++++--------- .../discovery/resolver/registry/registry.go | 5 ++++ .../discovery/resolver/registryV1/registry.go | 2 ++ 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/pkg/plugin/discovery/resolver/github/github.go b/pkg/plugin/discovery/resolver/github/github.go index 8e1b5d1..50afb64 100644 --- a/pkg/plugin/discovery/resolver/github/github.go +++ b/pkg/plugin/discovery/resolver/github/github.go @@ -18,6 +18,8 @@ import ( "golang.org/x/oauth2" ) +var _ resolver.Resolver = &Resolver{} + type Resolver struct { ghClient *github.Client } @@ -105,6 +107,10 @@ func (g *Resolver) getAllValidGitHubReleases(repoOwner, repoName string) (ghRele continue } + if len(release.Assets) == 0 { + continue + } + if semverTag, err := semver.NewVersion(release.GetTagName()); err == nil { ret = append(ret, &ghRelease{version: semverTag, release: release}) } diff --git a/pkg/plugin/discovery/resolver/github/known_plugins.go b/pkg/plugin/discovery/resolver/github/known_plugins.go index 08228e4..d5426a8 100644 --- a/pkg/plugin/discovery/resolver/github/known_plugins.go +++ b/pkg/plugin/discovery/resolver/github/known_plugins.go @@ -1,17 +1,18 @@ package github var knownPlugins = map[string]string{ - "provider-github": "go-semantic-release/provider-github", - "provider-gitlab": "go-semantic-release/provider-gitlab", - "changelog-generator-default": "go-semantic-release/changelog-generator-default", - "commit-analyzer-default": "go-semantic-release/commit-analyzer-cz", - "condition-default": "go-semantic-release/condition-default", - "condition-github": "go-semantic-release/condition-github", - "condition-gitlab": "go-semantic-release/condition-gitlab", - "files-updater-npm": "go-semantic-release/files-updater-npm", - "provider-git": "go-semantic-release/provider-git", - "condition-bitbucket": "go-semantic-release/condition-bitbucket", - "files-updater-helm": "go-semantic-release/files-updater-helm", - "hooks-goreleaser": "go-semantic-release/hooks-goreleaser", - "hooks-npm-binary-releaser": "go-semantic-release/hooks-npm-binary-releaser", + "provider-github": "go-semantic-release/provider-github", + "provider-gitlab": "go-semantic-release/provider-gitlab", + "changelog-generator-default": "go-semantic-release/changelog-generator-default", + "commit-analyzer-default": "go-semantic-release/commit-analyzer-cz", + "condition-default": "go-semantic-release/condition-default", + "condition-github": "go-semantic-release/condition-github", + "condition-gitlab": "go-semantic-release/condition-gitlab", + "files-updater-npm": "go-semantic-release/files-updater-npm", + "provider-git": "go-semantic-release/provider-git", + "condition-bitbucket": "go-semantic-release/condition-bitbucket", + "files-updater-helm": "go-semantic-release/files-updater-helm", + "hooks-goreleaser": "go-semantic-release/hooks-goreleaser", + "hooks-npm-binary-releaser": "go-semantic-release/hooks-npm-binary-releaser", + "hooks-plugin-registry-update": "go-semantic-release/hooks-plugin-registry-update", } diff --git a/pkg/plugin/discovery/resolver/registry/registry.go b/pkg/plugin/discovery/resolver/registry/registry.go index 6bb8db6..9c4532f 100644 --- a/pkg/plugin/discovery/resolver/registry/registry.go +++ b/pkg/plugin/discovery/resolver/registry/registry.go @@ -13,6 +13,11 @@ import ( "github.com/go-semantic-release/semantic-release/v2/pkg/plugin/discovery/resolver" ) +var ( + _ resolver.Resolver = &Resolver{} + _ resolver.BatchResolver = &Resolver{} +) + type Resolver struct { client *client.Client } diff --git a/pkg/plugin/discovery/resolver/registryV1/registry.go b/pkg/plugin/discovery/resolver/registryV1/registry.go index aa6588f..2f4b2bc 100644 --- a/pkg/plugin/discovery/resolver/registryV1/registry.go +++ b/pkg/plugin/discovery/resolver/registryV1/registry.go @@ -14,6 +14,8 @@ import ( const DefaultEndpoint = "https://plugins.go-semantic-release.xyz/api/v1" +var _ resolver.Resolver = &Resolver{} + type Resolver struct { endpoint string } -- GitLab